F503i and embot driver in Swift
import Foundation
let emb = Macembot()
var n = 0
Timer.scheduledTimer(withTimeInterval: 1.0, repeats: true) { timer in
emb.led(idx: 1, n: n % 2 == 0, brightness: 255)
n += 1
print("\(n)")
}
RunLoop.main.run()
- led(idx, n, brightness = 255) // idx:1-3, n:Bool
- buzzer(n) // 51=C?
- servo(idx, n) // idx:1-3, n:0-180
- getBrightness() -> Uint16 0-600
- setKeyDownListener(_ callback: (UInt32) -> Void)
- setKeyUpListener(_ callback: (UInt32) -> Void)
cd led
swiftc ../Macembot.swift main.swift
./main
cd music
swiftc ../Macembot.swift main.swift
./main
cd servo_embot
swiftc ../Macembot.swift main.swift
./main
cd keys_F503i
swiftc ../Macembot.swift main.swift
./main
cd lightsensor_F503i
swiftc ../Macembot.swift main.swift
./main
cd keyboard_by_F503i
swiftc ../Macembot.swift main.swift
./main