Table of Contents
Objective
This lesson will show you how to program the mBot Neo to recognize colors while following a line. It will then show you how test your program on the mBot Neo.
Parts Required
The parts below are required to complete this lesson. Note that all parts are included in the mBot Neo kit that can be purchased on Amazon.
- Assembled mBot Neo from Lesson 1
- USB Cable
- Line following paper
Software Programming
- Connect the USB cable to the CyberPi on the mBot Neo and plug the cable into your computer
This will charge up your mBot Neo while you create the program
- Open the mBlock app on your computer
You can download the mBlock app from mBlock Download if it isn't already installed
- Click the Variables selector and click the Make a Variable button to create the following variables for all sprites
This will allow your program to store information that it needs and change it as it runs
- Click the My Blocks selector and click the Make a Block button to create the following blocks
This will allow you to make your program neater
- Slide the power switch on the mCore mainboard on the mBot to the OFF position and disconnect the USB cable from the mBot Neo
Robot Testing
Follow the steps below to test out the program you just created
- Place the line following map on the floor
- Place the mBot on the line and slide the power switch on the mBot2 Shield on the mBot Neo to the ON position
- Press the B button on the CyberPi to start the mBot Neo moving
- When you're finished watching the mBot Neo follow the line, press the A button
- Change the sounds and LED colors to see how they change what the mBot Neo does
What is your favorite sound?
Try changing the LED display block with the LED animation block to see what it does
What changes will make the mBot Neo accelerate on detecting colors after it has stopped?
When you're ready to try out changes to your program, connect the USB cable to the CyberPi on the mBot Neo, plug the cable into your computer, and repeat steps 76 through 78 above