PDA

Orijinalini görmek için tıklayınız : 30. Yavaş yavaş yanıp sönen led



bolubeyi
20.Temmuz.2015, 19:54
Bu dersimizde bir ledi arduino ile yavaş yavaş yakıp yavaş yavaş söndüreceğiz. Kodlamadaki parametreleri değiştirerek ortaya çıkan animasyonu değiştirebilirsiniz.
jh_dPHIkH2U

https://temrinlerim.org/images/arduino36.png

Fritzing şeması:
Fritzing dosyasını konu ekinden indirebilirsiniz.
https://temrinlerim.org/images/led_bb.png

Arduino kodlarımız:

int i = 0;
const int LED = 11; //define the pin we use for LED

void setup() {
pinMode(LED, OUTPUT); //set pin 11 as OUTPUT
}

void loop() {
for (int i = 0; i < 255; i++){ //if i is less than 255 then increase i with 1
analogWrite(LED, i); //write the i value to pin 11
delay(6); //wait 5 ms then do the for loop again
}
for (int i = 255; i > 0; i--){ //descrease i with 1
analogWrite(LED, i);
delay(6);
}
}

Orjinal konu: Yavaş yavaş yanan ve sönen led (https://temrinlerim.org/index.php?topic=209.0)