Part 1 Objective
User writes a program to achieve that when the mBot starts, the mBot moves forward, backward, turns left and right in turn, and finally stops moving.
Part 2 Preparation
-
mBot x1
-
USB cable x1
-
Computer with network access
-
Use a data cable to connect the mBot to the computer.
-
Open MBlock5 (PC, Web, APP), click "Add" in the lower left device area, select mBot in the device library, and click “Connect”.(Live mode: you can click the building block to observe the real-time running effect, but you need to keep the data cable connected to the computer; Upload mode: You can upload the program to mBot, at which time you can unplug the data cable to run the program. ), this course needs to switch to "Upload mode".
Part 3 Programming
User uploads the program to make the mBot stop moving after going forward, backward, left, and right turns.
Source program diagram
Part 4 Procedure source code
Part 5 Practice
-
Modify the movement time value in the blocks to make the mBot go further.
-
Try other motion module blocks and observe the operation effect of mBot.
Comments
Please sign in to leave a comment.