Case 13 - mBot Mega avoids obstacles

Part 1   Objective

After you upload the program, mBot Mega moves straight forward. When mBot Mega encounters an obstacle, it turns left or right randomly to avoid the obstacle.

41.gif

Part 2   Preparation

  • Assembled mBot Mega x 1

  • USB cable x 1

  • Computer with network access x 1

Connect mBot Mega to the computer by using the cable, open mBlock 5 (PC client or web version), click +add, select mBot Mega from the Device Library, click Connect, and select the Upload mode.

42.gif

43.gif

Note: Install the Mecanum wheels correctly and connect the cables according to the user manual for mBot Mega.

Part 3   Programming

mBot Mega moves straight forward. When mBot Mega encounters an obstacle, it turns left or right randomly to avoid the obstacle. The programming mode is as follows:

44.gif

Part 4   Practice

Build a maze for mBot Mega and see if it can get out of the maze.

 

 

Was this article helpful?
1 out of 3 found this helpful

Comments

0 comments

Please sign in to leave a comment.