Test Result; Code Explanation - Keyestudio Ks0428 Manual

Table of Contents

Advertisement

www.keyestudio.com
for (value = 0; value <255; value = value + 1)
{
analogWrite (ledPin, value); // LED lights gradually light up
delay (5); // delay 5MS
}
for (value = 255; value> 0; value = value-1)
{
analogWrite (ledPin, value); // LED gradually goes out
delay (5); // delay 5MS
}}//**********************************************************

(6) Test Result

Upload test code successfully, LED gradually becomes brighter then
darker, like human breath, rather than light on and off immediately.

(7) Code Explanation

When we need to repeat some statements, we could use FOR
statement.
FOR statement format is shown below:
FOR cyclic sequence:
Round 1:1 → 2 → 3 → 4
80

Advertisement

Table of Contents
loading

Table of Contents