1. Purpose of the Case
Program the CoCube robot to achieve basic movement functions.
2. Materials Used
3. Software Platform
4. Start Programming
CoCube Motion Control
Connect Device: Connect the Microblocks IDE with the CoCube robot via Bluetooth.
Control the robot to move forward, backward, left, and right: In the "CoCube" block library, drag out the first two blocks related to motor control. These blocks can control the movement direction, speed, and duration of the CoCube robot.
- "Wheels Break" and "Wheels Stop": Write the following code to experience the difference between "wheels break" and "wheels stop". The "wheels break" will stop the robot immediately, while "wheels stop" simply removes the power from the motor, causing the CoCube robot to continue sliding forward a short distance due to inertia. You may need to use different stopping blocks for certain specific tasks.
- Control the robot to perform "circular motion": The CoCube robot chassis is designed in a tracked shape. By controlling different speeds for the left and right wheels, more motion trajectories can be simulated, such as making the CoCube robot drive in a circle.
Reference Code Example: MicroBlocks——CoCube Case 02 Motion Basics
5. Challenge
Use motor control blocks to manipulate the CoCube to complete a square trajectory motion.
Try experimenting: how long does it take for the robot to rotate left at a speed of 30 to turn precisely 90 degrees?
Reference Code Example:
MicroBlocks——CoCube Case 02 Square Trajectory Motion
Careful observation might reveal that after some time, the accumulated error of CoCube's left turns will become increasingly larger, causing the square trajectory to gradually distort. How can we achieve more precise movements?
In the next case study, let’s learn how to use the CoMap!