1. Purpose of the Case
Control the CoCube robot using a keyboard.
2. Materials Used
3. Software Platform
4. Start Programming
- Enable Keyboard Event Functionality: By reading keyboard signals, you can control the CoCube robot to perform corresponding actions, enabling remote control functionality. First, enable the keyboard event by clicking the settings button and selecting "Keyboard Event." When the checkmark (√) in front of it changes from gray to white, it has been successfully enabled.
Connect Device: Connect the MicroBlocks IDE to the CoCube robot wirelessly. Attach the gripper module to the CoCube robot.
Load Interface Program for CoCube Robot
Load the interface program from the MicroBlocks online example library:
File -> Open -> Examples -> By Board -> CoCube -> CoCube KeyBoard Control
- Customize Functional Keys
The loaded example code is shown below:
You can also customize keys to implement keyboard control. Use the "When I Receive" and "Say Last Message" blocks to listen for the names of keyboard events. Enter the name into the "When I Receive" block to assign the corresponding keyboard event.
MicroBlocks - CoCube Keyboard Control
5. Advanced Features
In addition to enabling keyboard events in the MicroBlocks IDE to control the CoCube robot, you can also control the CoCube robot through the following webpage.
After ensuring that the CoCube robot has been programmed with keyboard control, disconnect the CoCube robot from the MicroBlocks IDE, then open the link below and reconnect the CoCube robot via BLE wireless connection.
6. Challenge
Get creative and design a Gold Miner mini-game using the keyboard control feature.