But wait? The micro:bot appears to be driving in the
reverse
relative to the front of the robot even though we told
the robot to move
forward
in the code?!? There are a few reasons why this may be happening. Depending on
how the motors were manufactured, they wires may be switched. Or the wires were connected incorrectly.
One method is to use the
set ____ motor invert to ____
block for each motor without rewiring the motors.
Simply invert the motors setting each to
true
. The following experiments will invert the motor wire connection
relative to how we assembled the robot earlier.
The other method is to physically rewire the motor wires. Simply flip the wire connections for each channel in order
for the robot to move forward. Connect the "
LEFT MOTOR
" channel's red wire to the silkscreen labeled as
"
BLACK
" and black wire wire to the silkscreen labeled as "
RED
". Then flip the wires for the "
RIGHT MOTOR
"
channel with the right motor. The wiring may look similar to the image shown below on the right. If you flip the
wires after this point, make sure to
set left motor invert to ____
and
set right motor invert to ____
back
to
false
for future experiments.
Before Flipping the Wires
After Flipping Wires
Go Further:
Now that you have a moving robot, can you write a program that would tell your robot to drive in
a square? How about a star? What about having it dance?
Troubleshooting
moto:bit package is not showing up
- Try installing it again from the add package option in MakeCode
Micro:Bit Not Showing Up On My Machine
- Try unplugging the USB cable and plugging it back in. Also,
be sure that you have the cable inserted all the way into your micro:bit
Robot Not Moving
- Make sure your motors are hooked up correctly in the motor ports and your motor
power switch is set to "RUN Motors", the battery pack is plugged in, and you have fresh batteries.