EasyManua.ls Logo

Eckstein komponente KS0530 - Page 97

Default Icon
160 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...
97
(7) Extension Practice
Lets observe the status of LED if we change the delay value.
/*
keyestudio sun_follower
lesson 2.2
PWM
http://www.keyestudio.com
*/
#define LED 3 //define the pin of LED as D10
int value;
void setup()
{
pinMode(LED, OUTPUT);// initialize digital pin LED as an output.
}
void loop () {
for (value = 0; value < 255; value = value + 1) {
analogWrite (LED, value); // LED lights gradually light up
delay (20); // delay 20MS
}