mBot – Blink

LOWER SECONDARY

Grade Level

COMPUTER SCIENCE

Subjects

mBot

Product

40MINS

Estimated duration
Longer description

Hardware requirements:

mBot/mCore Control Panel

Implementation:

Upload the program to Arduino

Effect demo

 

Example programs

 

Script description

Figures represent the brightness; the larger the figure is, the more brightness it represents (range 0~255).
When the color parameters are 0, the LED light is off.
Use “wait” block to control the red time and off time of the onboard LED light (keep the status of the previous block without proceeding to the next). Different time can be set to control the blink frequency of the LED light.
“Repeat” block means to repeat the contained script. This block is used to control the blink frequency.


Knowledge points
What if we delete the two  block in the example?
As the program is uploaded to Arduino, it runs very fast, even quicker than the duration of vision (about 0.05s). If you delete , the main control board will run quickly the program “turn on and off the LED red light”, but you cannot see it blinking with your eyes. To see the blinking, you need to add a waiting time at the end of the script that controls the on and off of the LED light.
Please compare the following scripts and their effects:

Script Effects
(please upload the program to Arduino)
  Repeat it for 10 times and the LED light will be turned on and off. You cannot even see the blinking (the script runs in a blink).
  Repeat it for unlimited times and the LED light is kept on (the script runs continually and your eyes cannot capture the blinking).


Extended tasks

Task 1 Change the sample scripts to keep the onboard LED blinking (you need to upload the program to the Arduino).
Task 2 Change the sample scripts to increase the blinking frequency of the onboard LED (you need to upload the program to the Arduino).

 

Attached-mCore main control board LED diagram

 

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.