Table of Contents
Objective
This lesson will show you how to program the mBot Neo to follow 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
- 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 initial values of the base_power and kp variables to see how they change the mBot Neo line following
What values make the mBot Neo follow the line fast without losing control
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 42 through 44 above