Table of Contents
Objective
This lesson will show you how to program the mBot to avoid obstacles. It will then show you how test your program on the mBot.
Parts Required
The parts below are required to complete this lesson. Note that all parts except the styrofoam blocks are included in the mBot kit that can be purchased on Amazon.
- Assembled mBot from Lesson 1
- USB Cable
- Styrofoam Blocks that are at least 5in tall and 2in thick
Software Programming
- Open the mBlock app on your computer
You can download the mBlock app from mBlock Download if it isn't already installed
- Connect the USB cable to the mCore mainboard on the mBot and plug the cable into your computer
- Slide the power switch on the mCore mainboard on the mBot to the OFF position and disconnect the USB cable from the mBot
Robot Testing
Follow the steps below to test out the program you just created
- Place some of the styrofoam blocks on the floor
- Place the mBot on the floor and slide the power switch on the mCore mainboard on the mBot to the ON position
- Press the black button on the front left of the mCore mainboard on the mBot to start the mBot moving
- When you're finished watching the mBot avoid obstacles, pick it up and slide the power switch on the mCore mainboard to the OFF position
What should change in your program to make the mBot turn left when it senses an obstacle? Make that change and see if it works
When you're ready to try out changes to your program, repeat steps 16 through 19 above
How could you change the program so that you can tell the mBot to stop moving instead of picking it up when you're done? Make that change and see if it works
How can you make the mBot start the obstacle avoidance using the infrared remote control like it did in Lesson 1? Make that change and see if it works