Brightness gradient

4,118
Author: Yisong Xu, Si Xu

The onboard LED lights red and the brightness increase gradually. When the brightness reaches a certain value, the onboard LED turns off. Repeat this process.

Hardware requirements:

mBot/mCore Control Panel

Implementation:

Upload the program to Arduino

Example program download:

Brightness gradient.sb2

download

Effect demo

 

Example programs

 

Script description

Define Variable  as the brightness value of the red light of the onboard LED.
Set the initial value of Variable  as 0, and then the onboard LED is initially off.
Set the varied value of Variable  and the brightness increases by 1 each time
Avoid excessively fast change of the red light. Wait to control its changing speed.
You can adjust the number “60” here and set the maximum brightness the onboard Led can achieve.

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