Swiftpack.co -  Package - balnaves/SwiftySR700
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
A Swift package to control the FreshRoastSR700 coffee roaster.
.package(url: "https://github.com/balnaves/SwiftySR700.git", from: "0.1.2")


A Swift package to control a FreshRoastSR700 coffee roaster.

Installing Swift 5 on Raspberry Pi

First, add the swift-arm repo:

curl -s https://packagecloud.io/install/repositories/swift-arm/release/script.deb.sh | sudo bash

Then, use apt to install Swift

sudo apt-get install swift5

Creating a Swift Project

mkdir MyFirstProject
cd MyFirstProject
swift package init --type=executable
swift run

Adding the SwiftySR700 package to your project

Edit your Package.swift file to add the SwiftySR700 module as a dependency:

    dependencies: [
        // Dependencies declare other packages that this package depends on.
        .package(url: "http://github.com/balnaves/SwiftySR700.git", from: "0.1.0")

Add SwiftySR700 to your main target:

        name: "MyFirstProject",
        dependencies: ["SwiftySR700"]),

Using the SwiftySR700 library in your project

A SwiftySR700 object can be used with closures, delegate callbacks or a combination of both. For examples, see the example projects, there's one showing each type of usage. In the simplest case, your main.swift might look something like this

import Foundation
import Dispatch
import SwiftySR700

class RoastController {
    let roaster = SwiftySR700()
    func start() {
        roaster.connect { connectionState in
            if connectionState == .ready {
                self.roaster.roast(temperature: 200, fan: 5, seconds: 30) {
            else {
                print("Roaster not ready, state = \(connectionState)")

let controller = RoastController()
dispatchMain() // Keep our executable running until we exit()


Depending on how far it evolves, this project could be considered a port of, or at least heavily inspired by, the python library FreshRoastSR700. For a number of reasons, I wanted to try a version in swift and Roastero's library was a source of information and inspiration. All of the protocol investigation and documentation was done there and used here as a reference.


  • This library is based heavily on the work of FreshRoastSR700.
  • I use the most excellent SwiftSerial library to handle the serial communications.


Stars: 0
Last commit: 4 weeks ago

Release Notes

Added serial port path
4 weeks ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco