/pxt-KeiganMotor

MakeCode Extension to control KeiganMotor by micro:bit

Primary LanguageTypeScript

pxt-keiganmotor

You can control KeiganMotor KM-1 Series via micro:bit

The device firmware version needs to be >= 2.00.

Basic

First

You need to specify unique 4 digits "name" of KeiganMotor to control. You can know it by two ways as belows.

  1. The last 4 digits of the serial number.
  • If the serial number is "ABCDEFGH", the name is "EFGH"
  1. The 4 digits Included by devicename of Bluetooth Low Energy.
  • If the device name is "KM-1 EFGH#RGB", the name is "EFGH".
    • You can use "KeiganCore" app or other BLE apps to get device name.

Initialization

// Initialize KeiganMotor by its name
let m = keiganmotor.create("EFGH")

Enable Action

m.enable()

Rotate

m.run(1) // run at velocity 1 [radians/sec]
basic.pause(10000) // wait for 10 seconds
m.stop() // stop (set speed to 0)

LED

m.led(led_state.ON_SOLID, 255, 255, 0) // Set LED color to RGB(255,255,0) = yellow

License

MIT

Supported targets

  • for PXT/microbit (The metadata above is needed for package search.)