mbotneo:lesson6
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
mbotneo:lesson6 [2024/03/29 09:51] – jstruebel | mbotneo:lesson6 [2024/03/29 09:51] (current) – jstruebel | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== Objective ===== | ||
+ | This lesson will show you how to program the mBot Neo to respond to sound. 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 except the styrofoam blocks are included in the [[https:// | ||
+ | |||
+ | - Assembled mBot Neo from [[: | ||
+ | - USB Cable | ||
+ | - 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 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</ | ||
+ | - Click the Events selector and drag the "when CyberPi starts up" block to the coding pane\\ \\ <WRAP box>{{ : | ||
+ | - Click the Display selector and drag the "print makeblock and move to a newline" | ||
+ | - Change the " | ||
+ | - Click the Control selector and drag the "wait until < >" block to the coding pane and snap it to the bottom of the stack\\ \\ <WRAP box>{{ : | ||
+ | - Click the Operators selector and drag the "( ) > 50" block to the coding pane and snap it into the "wait until < >" block\\ \\ <WRAP box>{{ : | ||
+ | - Click the Sensing selector and drag the " | ||
+ | - Change the " | ||
+ | - Click the Control selector and drag the " | ||
+ | - Drag the "if < > then else" block to the coding pane and snap it inside 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 "moves forward at 50 rpm" block to the coding pane and snap it inside the top section of the if-then-else block\\ \\ <WRAP round tip>This will cause the mBot to move forward whenever it does not sense an obstacle within 10cm</ | ||
+ | - Click the Control selector and drag the "if < > then else" block to the coding pane and snap it inside the bottom section of the if-then-else block\\ \\ <WRAP box>{{ : | ||
+ | - Click the Operators selector and drag the "( ) = 50" block to the coding pane and snap it inside the if-then block\\ \\ <WRAP box>{{ : | ||
+ | - Drag the "pick random 1 to 10" block to the coding pane and snap it inside the "( ) = 50" block\\ \\ <WRAP box>{{ : | ||
+ | - Change 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 top section of the if-then-else block\\ \\ <WRAP round tip>This will cause the mBot Neo to turn left whenever it senses an obstacle within 10cm and the random number is 1</ | ||
+ | - 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 " | ||
+ | - Click the Events selector and drag the "when button A pressed" | ||
+ | - Click the Control selector and drag the " | ||
+ | - 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 Code 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 some of the styrofoam blocks on the floor | ||
+ | - Place the mBot on the floor and slide the power switch on the mBot2 Shield on the mBot Neo to the ON position | ||
+ | - Make a loud sound (clap) to start the mBot Neo moving | ||
+ | - When you're finished watching the mBot Neo avoid obstacles, press the A button | ||
+ | <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 31 through 33 above</ | ||
+ | |||
+ | [[: |
mbotneo/lesson6.txt · Last modified: by jstruebel