$ npm install
$ npm run lint # run the style checker
$ npm run build # output at built/rovercode.hex
$ npm run flash:mac # flash rovercode.hex to the micro:bit connected to your Mac
$ # or
$ npm run flash:linux # flash rovercode.hex to the micro:bit connected to an Ubuntu machine
The following protocol is used over the Nordic virtual BLE serial channel.
The common format is {identifier}:{comma-separated values}
.
Messages from the webapp to the micro:bit end with a \n
; messages from the micro:bit to the webapp do not.
In all cases, "left" and "right" are when facing the direction that the micro:bit LED grid faces when plugged into the Gigglebot.
webapp -> micro:bit
left-motor
and right-motor
and both-motors
.
Index | Description | Type | Unit |
---|---|---|---|
0 | Motor power | Number | -100 to 100 |
left-motor:0\n
right-motor:100\n
both-motors:-40\n
webapp -> micro:bit
disp
.
Index | Description | Type | Unit |
---|---|---|---|
0 | Message | String | n/a |
disp:hello world\n
micro:bit -> webapp
light-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Left light sensor value | Number | 0-1023 |
1 | Right light sensor value | Number | 0-1023 |
light-sens:1023,1023
micro:bit -> webapp
line-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Left line sensor value | Number | 0-1023 |
1 | Right line sensor value | Number | 0-1023 |
line-sens:1023,1023
Support for the distance sensor is not implemented yet. The Gigglebot helper function causes a large jump in our program memory size.
micro:bit -> webapp
dist-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Sonar distance sensor value | Number | 0 - ? millimeters |
dist-sens:1000
micro:bit -> webapp
ub-temp-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | micro:bit ambient temp | Number | Degrees C |
ub-temp-sens:24
micro:bit -> webapp
ub-light-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | micro:bit light level | Number | 0 - 255 |
ub-light-sens:255
micro:bit -> webapp
accel
Index | Description | Type | Unit |
---|---|---|---|
0 | Acceleration (x) | Number | milligravities |
1 | Acceleration (y) | Number | milligravities |
2 | Acceleration (z) | Number | milligravities |
accel:1000,1000,1000
micro:bit -> webapp
gyro
Index | Description | Type | Unit |
---|---|---|---|
0 | Rotation (pitch) | Number | Degrees |
1 | Rotation (roll) | Number | Degrees |
gyro:100,100
Support for the compass sensor is not implemented yet. When we try it, we see unknown runtime errors.
micro:bit -> webapp
compass-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Compass heading | Number | Degrees |
compass-sens:100
Support for the magnetic force sensor is not implemented yet. When we try it, we see unknown runtime errors.
micro:bit -> webapp
mag-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Magnetic force (x) | Number | uT |
1 | Magnetic force (y) | Number | uT |
2 | Magnetic force (z) | Number | uT |
mag-sens:60,80,100
micro:bit -> webapp
battery-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Battery voltage | Number | milliVolts |
battery-sens:3300
Support for the dew point sensor is not implemented yet. When we try it, we see unknown runtime errors.
micro:bit -> webapp
dewpoint-sens
Index | Description | Type | Unit |
---|---|---|---|
0 | Dew point | Number | Degrees C |
dewpoint-sens:24
micro:bit -> webapp
button
Index | Description | Type | Unit |
---|---|---|---|
0 | Button identifier | Letter | None |
button:a
- for PXT/microbit (The metadata above is needed for package search.)