Part 1 Objective
User writes a program to display the values detected by the line following sensor in real time on the stage area.
Part 2 Preparation
USB cable x1
Computer with network access
Use a data cable to connect the mBot to the computer.
Open MBlock5 (PC, Web, APP), click "Add" in the lower left device area, select mBot in the device library, and click “Connect”.(Live mode: you can click the building block to observe the real-time running effect, but you need to keep the data cable connected to the computer; Upload mode: You can upload the program to mBot, at which time you can unplug the data cable to run the program. ), this course needs to switch to "Live mode".
Part 3 Programming
Create a new variable and name it "Line Patrol Value" to store the value detected by the Line Patrol sensor, select it to be displayed on the Stage in real time. Please correctly select the interface number that matches the sensor connection interface.
Source program diagram
Part 4 Procedure source code
Part 5 Practice
User places black and white paper under the line sensor and observes the change in the reading of the line sensor in the stage area.
Put a different color of paper under the line line sensor and observe whether the reading of the line line sensor on the stage changes.