Skip to content

Repository files navigation

pxt-rovercode

Development Usage

$ 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 

Protocol

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.

Set motor power

Direction

webapp -> micro:bit

Identifier

left-motor and right-motor and both-motors.

Data

IndexDescriptionTypeUnit
0Motor powerNumber-100 to 100

Example

left-motor:0\n
right-motor:100\n
both-motors:-40\n

Display message

Direction

webapp -> micro:bit

Identifier

disp.

Data

IndexDescriptionTypeUnit
0MessageStringn/a

Example

disp:hello world\n

Light Sensor

Direction

micro:bit -> webapp

Identifier

light-sens

Data

IndexDescriptionTypeUnit
0Left light sensor valueNumber0-1023
1Right light sensor valueNumber0-1023

Example

light-sens:1023,1023

Line Sensor

Direction

micro:bit -> webapp

Identifier

line-sens

Data

IndexDescriptionTypeUnit
0Left line sensor valueNumber0-1023
1Right line sensor valueNumber0-1023

Example

line-sens:1023,1023

Distance Sensor (NOT IMPLEMENTED)

Support for the distance sensor is not implemented yet. The Gigglebot helper function causes a large jump in our program memory size.

Direction

micro:bit -> webapp

Identifier

dist-sens

Data

IndexDescriptionTypeUnit
0Sonar distance sensor valueNumber0 - ? millimeters

Example

dist-sens:1000

uBit Temperature Sensor

Direction

micro:bit -> webapp

Identifier

ub-temp-sens

Data

IndexDescriptionTypeUnit
0micro:bit ambient tempNumberDegrees C

Example

ub-temp-sens:24

uBit Light Sensor

Direction

micro:bit -> webapp

Identifier

ub-light-sens

Data

IndexDescriptionTypeUnit
0micro:bit light levelNumber0 - 255

Example

ub-light-sens:255

Acceleration Sensor

Direction

micro:bit -> webapp

Identifier

accel

Data

IndexDescriptionTypeUnit
0Acceleration (x)Numbermilligravities
1Acceleration (y)Numbermilligravities
2Acceleration (z)Numbermilligravities

Example

accel:1000,1000,1000

Gyroscope Sensor

Direction

micro:bit -> webapp

Identifier

gyro

Data

IndexDescriptionTypeUnit
0Rotation (pitch)NumberDegrees
1Rotation (roll)NumberDegrees

Example

gyro:100,100

Compass Sensor (NOT IMPLEMENTED)

Support for the compass sensor is not implemented yet. When we try it, we see unknown runtime errors.

Direction

micro:bit -> webapp

Identifier

compass-sens

Data

IndexDescriptionTypeUnit
0Compass headingNumberDegrees

Example

compass-sens:100

Magnetic Force Sensor (NOT IMPLEMENTED)

Support for the magnetic force sensor is not implemented yet. When we try it, we see unknown runtime errors.

Direction

micro:bit -> webapp

Identifier

mag-sens

Data

IndexDescriptionTypeUnit
0Magnetic force (x)NumberuT
1Magnetic force (y)NumberuT
2Magnetic force (z)NumberuT

Example

mag-sens:60,80,100

Battery Sensor

Direction

micro:bit -> webapp

Identifier

battery-sens

Data

IndexDescriptionTypeUnit
0Battery voltageNumbermilliVolts

Example

battery-sens:3300

Dew Point Sensor (NOT IMPLEMENTED)

Support for the dew point sensor is not implemented yet. When we try it, we see unknown runtime errors.

Direction

micro:bit -> webapp

Identifier

dewpoint-sens

Data

IndexDescriptionTypeUnit
0Dew pointNumberDegrees C

Example

dewpoint-sens:24

Buttons

Direction

micro:bit -> webapp

Identifier

button

Data

IndexDescriptionTypeUnit
0Button identifierLetterNone

Example

button:a

Supported targets

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

About

A service for controlling the Gigglebot from Rovercode through the micro:bit BLE.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages