Case 7 - Read the value of the line follower sensor

Part 1 Objective

After you write the program, the stage area of mBlock 5 displays the value detected by the line follower sensor in real time.

e9a18217-1296-4d80-9de6-7c9ceb7cf6dd.gif

Part 2 Preparation

  • mBot x 1
  • USB cable (Type-B) x 1
  • Computer with network access x 1
  1. Connect mBot to the computer by using the cable.

55fc64d2-9018-49ab-9a13-78207cdaa64c.gif

  1. Open mBlock 5 (PC client or web version), click +add in the lower left Devices area, select mBot from the Device Library, click Connect, and select the Live mode. (Live mode: you can click on the blocks to see the real-time running effect, but you need to keep the cable connected to the computer. Upload mode: you can upload a program to mBot, and you can unplug the cable to run the program.)

1f42779c-3046-4fab-ae3c-a69ac96b1cc3.gif

Part 3 Programming

Make a variable and name it "line follower sensor value" to record the values of the line follower sensor and display the values on the stage area of mBlock 5 in real time. 

20230322-110511.gif

Script image

Part 5 Practice

  1. Place a piece of black paper and a piece of white paper under the line follower sensor respectively, and observe the change in the value of the line follower sensor on the stage area of mBlock 5.
  1. Place a piece of paper of another color under the line follower sensor, and observe whether the value of the line follower sensor on the stage area of mBlock 5 changes.
Was this article helpful?
1 out of 1 found this helpful

Comments

0 comments

Please sign in to leave a comment.