mbotneo:lesson4
Differences
This shows you the differences between two versions of the page.
mbotneo:lesson4 [2024/02/02 18:42] – created jstruebel | mbotneo:lesson4 [2024/02/07 20:21] (current) – jstruebel | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== 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 [[https:// | ||
+ | |||
+ | - Assembled mBot Neo from [[: | ||
+ | - USB Cable | ||
+ | - Line following paper | ||
+ | - Styrofoam Blocks that are at least 5in tall and 2in thick | ||
+ | |||
+ | ===== Software Programming ===== | ||
+ | |||
+ | - Connect the USB cable to the CyberPi on the mBot Neo and plug the cable into your computer\\ \\ <WRAP round tip>This will charge up your mBot Neo while you create the program</ | ||
+ | - Open the mBlock app on your computer\\ \\ <WRAP round tip>You can download the mBlock app from [[https:// | ||
+ | - Click on the Extension button\\ \\ <WRAP box>{{ : | ||
+ | - Click the Add button under the mBot2 shield\\ \\ <WRAP box>{{ : | ||
+ | - Click on the Extension button\\ \\ <WRAP box>{{ : | ||
+ | - Click the Add button under the Quad RGB Sensor\\ \\ <WRAP box>{{ : | ||
+ | - Click on the Extension button\\ \\ <WRAP box>{{ : | ||
+ | - Click the Add button under the Ultrasonic Sensor 2\\ \\ <WRAP box>{{ : | ||
+ | - Click the Upload button under the Mode Switch section\\ \\ <WRAP round tip>This allows you to write your program without having the mBot Neo connected to your computer</ | ||
+ | - Perform steps 8 through 40 of [[: | ||
+ | - Drag the "if < > then else" block to the coding pane and snap in inside the top of the forever block\\ \\ <WRAP box>{{ : | ||
+ | - Click the Operators selector and drag the "( ) > 50" block to the coding pane and snap it into the if - then block\\ \\ <WRAP box>{{ : | ||
+ | - Click the Ultrasonic Sensor 2 selector and drag the " | ||
+ | - Change the " | ||
+ | - Click the mBot2 Chassis selector and drag the "turns left 90 until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Drag the "moves forward 100cm until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the 100 to 15 in the "moves forward 100cm until done" block\\ \\ <WRAP box>{{ : | ||
+ | - Drag the "turns left 90 until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the " | ||
+ | - Drag the "moves forward 100cm until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the 100 to 30 in the "moves forward 100cm until done" block\\ \\ <WRAP box>{{ : | ||
+ | - Drag the "turns left 90 until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the " | ||
+ | - Drag the "moves forward 100cm until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the 100 to 15 in the "moves forward 100cm until done" block\\ \\ <WRAP box>{{ : | ||
+ | - Drag the "turns left 90 until done" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Change the name of the program in the upper left to " | ||
+ | - Slide the power switch on the mBot2 Shield to the ON position and click the Connect button\\ \\ <WRAP box>{{ : | ||
+ | - Click the Upload button and wait for the upload to complete\\ \\ <WRAP box>{{ : | ||
+ | - 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 styrofoam blocks across the line to create obstacles | ||
+ | - 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 distances in the else section to see how they change the mBot Neo obstacle avoidance | ||
+ | <WRAP round help> | ||
+ | <WRAP round tip>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</ | ||
+ | |||
+ | [[: |