Part 1 Objective
The user writes the program and uploads it to mBot so that mBot has basic lighting capabilities.
Part 2 Preparation
-
mBot x1
-
USB cable x1
-
A computer connected to a network
-
Use a data cable to connect 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
After the user uploads the program to mBot, the LED lights of different colors flash alternately by repeating execution of the program to produce brilliant and colorful light flickering effects.
Source program diagram
Part 4 Procedure source code
Part 5 Practice
-
Change the duration of the light.
-
Modify the color of the light.
-
Increase/decrease the variety of light colors.
Comments
Please sign in to leave a comment.