Skip to content
MakeCode Extension to control KeiganMotor by micro:bit
Branch: master
Clone or download
Latest commit fe4b3dc Jul 12, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
_locales/ja Bug fixes. May 28, 2019
images Add files via upload May 20, 2019
.gitignore Initialize empty repo Mar 14, 2019
LICENSE.txt Update LICENSE.txt May 15, 2019 Update Jul 12, 2019 Update Jul 12, 2019
icon.png change icon.png May 16, 2019
main.ts Bug fixes. May 28, 2019
pxt.json Bug fixes. May 28, 2019
test.ts Updates. May 10, 2019


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


micro:bit cannot talk to KeiganMotor via RADIO when the firmware of micro:bit is compiled by the latest makecode editor. So please ise the above old editor "version v1" as follows.


  1. KeiganMotor KM-1 Series: The device firmware version needs to be more than 2.06
  2. MakeCode Editor for micro:bit (



You need to change KeiganMotor's RADIO mode from BLE to "micro:bit mode".

  1. Supply power to KeiganMotor.
  2. Push the middle "Stop" (square-marked) Button 10 times.
  3. It will reboot automatically and change to micro:bit mode. (LED will blink Yellow for 2 seconds right after startup when micro:bit mode.)

Once set to micro:bit mode, KeiganMotor will start with micro:bit mode after shutdown. If you push Stop Button 10 times again, it will be back to BLE mode.

MakeCode editor

Make a new project and add KeiganMotor extension to the project.

  1. Move to
  2. Click "Extensions" from the upper right gear button.
  3. Input "Keigan" or "" to the textbox
  4. Click to add "KeiganMotor" extension.
  5. Make sure that the extension "KeiganMotor" is displayed in the left column.


You need to specify KeiganMotor's unique 4 digits "name" and its RADIO group for micro:bit to control wirelessly. It is used in initializer of KeiganMotor on MakeCode editor as belows.

(1) Name

It is a unique specific 4 digit number of KeiganMotor. 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.

(2) RADIO group

You need to match RADIO group between MakeCode and KeiganMotor. The default RADIO group of KeiganMotor is 0. RADIO group can be from 0 to 255. If you want to control multiple KeiganMotors, you should assign separate RADIO group to them. (Please refer to the section "Control Multiple KeiganMotors" as belows.)

Get RADIO group of KeiganMotor

Use the following project.


  1. Set your KeiganMotor's 4 digit name to parameter "name".
  2. Download to micro:bit and push "A" button.
  3. If the name is found, the display shows the name and RADIO group number.

Write new RADIO group to KeiganMotor

Use the following project.


  1. Set your KeiganMotor's 4 digit name to parameter "name".
  2. Set a new group to parameter "newGroupId".
  3. Download to micro:bit and push "A" button.
  4. If the name is found, micro:bit will write newGroupId to KeiganMotor.
  5. KeiganMotor will reboot and start RADIO with newGroupId.

Sample Project

Make KeiganMotor rotate and control LED.



// Initialize KeiganMotor by RADIO group and its name
// RADIO group should be from 0 to 255
let m = keiganmotor.create(0, "EFGH") // RADIO group ID = 0, name = "EFGH"

Enable Action



m.runRpm(10) // run at velocity 10 [rotation/minute]
basic.pause(10000) // wait for 10 seconds
m.stop() // stop (set speed to 0)


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

Control Multiple KeiganMotors

You should change RADIO groupId separately to avoid to get jammed.

let m1 = keiganmotor.create(0, "EFGH")
let m2 = keiganmotor.create(1, "PQRS")



If you want to control multiple KeiganMotors that have the same RADIO group ID, You can avoid to get jammed by inserting "basic.pause(50)" between commands as belows.




Supported targets

  • for PXT/microbit (The metadata above is needed for package search.)
You can’t perform that action at this time.