Bluetooth automatically connects the Micro: Bit controller to Petoi robots with BiBoard (ESP32). First-come-first-serve.
It supports three models of robots:
- Bittle with Arm
- Bittle
- Nybble Upgrading the robot to the latest firmware (after Dec.2024) is required.
Click the GIF to open the YouTube demo.
Click the picture to open the YouTube demo.
The codes in the sub-folders are intermediate test codes during R&D. You only need to use microbit-JoyStick.hex for the formal functionality.
- Import the microbit-JoyStick.hex on the Microsoft MakeCode (https://makecode.microbit.org) site, and download the program to the Micro: Bit board.
- Upload the latest OpenCatEsp32 firmware to the (BiBoard).
- Power on the micro: Bit board first.
- Power on the Petoi robot.
- You can keep the Bit powered on and click the reset button on the BiBoard to reconnect.
The Micro: Bit will show , it means the BLE is connected successfully between the Micro: Bit board and BiBoard.
It will play a connection sound and display N for Nybble, B for Bittle, and R for Bittle R (with the robot arm).
Touch D
Joystick A B C F
E
Touch, A, B, C, D, E, F, A+B, C+E, D+F, E+F
ID: 0 1 2 3 4 5 6 7 8 9 10
Pin: 12 13 14 15
Touch is the logo in the middle. A and B are the Micro: Bit's built-in buttons.
Controls the robot's walking direction: forward, backward, left, right, and diagonally.
pushing the joystick full left/right turn rotation at the origin
Pushing forward twice quickly triggers fast forward.
Their functions correspond to the array keyCmd. Users can modify the instructions for specific robot types and corresponding buttons. Currently, only A+B, C+E, D+F, and E+F are used for double-button combinations. Users can add other combinations like A+F, B+D, etc., but these combinations may be inconvenient to press.
Pressing and holding a button and then moving the joystick can specify its direction. The default direction is random by a single click and release.
Different models will have slightly different key mapping.
The joystick needs 300 milliseconds to separate a double push event, causing the button + joystick forward action to respond slowly. A single-button behavior could be triggered before the combination key. When controlling the switch, there may be no response if the buttons are pressed too quickly.
Rongzhong Li
Petoi LLC
Jan. 20, 2025