Case 21 - Detecting Robot (III)

Part 1   Objective

Write a program to make the Detecting Robot move along a line.

71.gif

Part 2   Preparation

  • Mechanical parts and electronic modules of Detecting Robot

  • USB cable (Type-B) x 1

  • Computer with network access x 1

Follow the building steps to build a Detecting Robot. Install the MegaPi encoder/DC motor drivers on MegaPi, connect the motors to the motor ports on MegaPi by using the motor cables, connect MegaPi to the computer by using the USB cable, open mBlock 5 (PC client or web version), click +add, select Ultimate 2.0 from the Device Library, click Connect, and select the Upload mode.

72.gif

Part 3   Programming

Make the Detecting Robot move along a black or white line. The Detecting Robot moves forward when the value detected by the sensor is 0, turns right when the value is 1, turns left when the value is 2, and moves backward when the value is 3.

73.gif

Part 4   Practice

Try to adjust the speed of the Detecting Robot moving along the line.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.