EasyManua.ls Logo

Keyestudio Ks0428 - Test Result; Code Explanation

Keyestudio Ks0428
247 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
80
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

Table of Contents