Arduino ( 3 – 8 ) LED Fade In / Fade Out

 Code များအား ကူးယူရာတွင် Code များ မကျန်ခဲ့စေရန် သေချာဂုရုစိုက်၍ ကူးယူစေလိုပါသည်။

Code ##

const int ledPin = 9;

void setup() {

//Declare LED Pin as Output

pinMode(ledPin, OUTPUT);

}

void loop() {

for(int a = 0; a <= 255; a++)

//for ( initialize; control; increment or decrement)

{

analogWrite(ledPin, a );

delay(10); //Slowly turn on the LED

}

delay(200);

for(int a = 255; a >= 0; a–) {

analogWrite(ledPin, a);

delay(10); //Slowly turn off the LED

}

delay(200);

}


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *