Skip to content

marciok/SwiftFirmata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftFirmata

Build Status

A Swift wrapper on CFirmata.

The idea is to provide a framework to control Arduino using Swift, by implementing a Firmata protocol client.

Heavily inspired on: https://github.com/younata/firmata

Building:

cd Packages/CFirmata-0.3.0/
sudo make install
cd ../../
swift build 

Example:

import Foundation

// Blink led hooked on pin 13
let firmata = try! SwiftFirmata(connect: "/dev/cu.usbmodem1421", baud: 57600)
let pin = Pin(number: 13, mode: .Output)
firmata.configure(pin)

while (true) {
  firmata.digitalWrite(pin, level: .High)
  sleep(2)
  firmata.digitalWrite(pin, level: .Low)
  sleep(2)
}

About

A Swift wrapper on CFirmata

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages