works correctly and your robot is within the black square line, your robot should stay inside of the box forever!
Go Further:
So, you have built a robot corral! There is a lot of resources being used causing the micro:bot to
drive slow. Try removing the serial output, removing the
show LEDs
code blocks, adjusting the speed of the
motors, and tweaking the
pause
blocks to see if you can get the micro:bot to move faster in the square. Or
maybe try to use what you now know to build a maze for your robot to solve on its own! Better yet, try
adjusting the logic used in the
if
statements to have the micro:bot driving on a black surface and contained
within a white line.
Troubleshooting
Moto:Bit blocks not showing up
- Make sure you have a network connection and you have added the
package to your makeCode environment.
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.
Robot Not Driving Forward
- If your motors are hooked up correctly and we have inverted both motors in
the code, try hitting the reset button on the micro:bit. This can happen after uploading when initially
powering the micro:bit up.
Moving in Reverse?!
- There are two options if you notice the micro:bot moving in the wrong direction. As
explained above, you can flip the wiring of your motors or use the
set ____ motor invert to ____
block in
your
on start
block to change what is forward vs. reverse.
Robot Drives Over the Black Line
- Your motors may still be running as the micro:bit is updating the LEDs
pausing, or sending serial data to the USB. Make sure to have the micro:bot drive forward slowly (but not to
slow where the motors will not move) before taking an additional sensor reading. You can also try to adjust
the values or remove the blocks of code used for debugging. If the micro:bot drives to fast, it will not be able
to see the width of the black line. The width of the line may be too small or the material for the black line