Skip to content

keigan-motor/km-swift-ble

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

km-swift-ble

You can control your Keigan Motor via Bluetooth Low Energy using iOS devices.

Basic

Scan

KMBluetoothManager.sharedInstance.addObserver(self, forKeyPath:"motors", options: .new, context:nil)
KMBluetoothManager.sharedInstance.scan()

Connect

let motor:KMMotor = KMBluetoothManager.sharedInstance.motors[0]
motor.connect() // Connect to Keigan Motor

Action

motor.enable() // Power on
     .speed(rpm:10) // Set speed to 10 rpm
     .runForward() // Rotate forward

Examples

Move by 90 degree per 10 seconds

for i in 0 ..< 4 {
motor.move(byDegree:90)
     .wait(10000)
}

Requirement

  • Swift4
  • iOS10+

Installation

$ git clone https://github.com/keigan-motor/km-swift-ble

NOTE Carthage and CocoaPods will be supported in the future.

Author

@tkeigan Keigan Inc.

License

MIT

About

Keigan Motor SDK via Bluetooth Low Energy for Swift on iOS devices

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published