Double check to make sure they are hooked up correctly and in the proper orientation
Experiment 3a -- Simple IR Sensor Reading
Let's break up this experiment into two parts. First, we will have the micro:bot follow a straight dark, black line.
Then we will have a slightly more complex path to try to have the micro:bot drive around a path with a zigzagged
pattern.
Running Your Script
Be sure to add the moto:bit package as instructed in the Installing the moto:bit Package in MakeCode section of
this tutorial.
Now, you can either download the following example script below and drag and drop it onto your micro:bit, or use it
as an example and build it from scratch in MakeCode.
Calibration is very important with the line sensors to work accurately. Your environment will greatly affect the
P0 and P2 analog readings and thresholds for the surface values so you might have to customize these
numbers to suit your application.
This site uses cookies for analytics, personalized content and ads. By continuing to
browse this site, you agree to this use.
Simulator
on start
serial redirect to USB
set
left
set
right
turn motors
OFF
Microsoft MakeCode
Blocks
motor invert to
true
motor invert to
Terms of Use
JavaScript
true
Privacy
Download
Learn more
Edit
Need help?
Do you have a question about the micro:bot Kit and is the answer not in the manual?
Questions and answers