Arduino geliştirme kartında karaşimşek devresini anlatacağım. Kara şimşek devresine biraz değişiklik katalım dedik ve potansiyometre ile ışıkların yanma hızını değiştirdik.
Malzemeler:
- Arduino Uno
- 10K Potansiyometre
- 7 adet LED
- 7 adet Direnç
int led1=4; int led2=5; int led3=6; int led4=7; int led5=8; int led6=9; int led7=10; int sure; int pot=A0; void setup() { pinMode(led1,OUTPUT); pinMode(led2,OUTPUT); pinMode(led3,OUTPUT); pinMode(led4,OUTPUT); pinMode(led5,OUTPUT); pinMode(led6,OUTPUT); pinMode(led7,OUTPUT); } void loop() { sure=analogRead(pot); sure=map(sure, 0, 1023, 30, 1000); delay(10); ledler(sure); } void ledler(int sure){ digitalWrite(led1,HIGH); delay(sure); digitalWrite(led1,LOW); digitalWrite(led2,HIGH); delay(sure); digitalWrite(led2,LOW); digitalWrite(led3,HIGH); delay(sure); digitalWrite(led3,LOW); digitalWrite(led4,HIGH); delay(sure); digitalWrite(led4,LOW); digitalWrite(led5,HIGH); delay(sure); digitalWrite(led5,LOW); digitalWrite(led6,HIGH); delay(sure); digitalWrite(led6,LOW); digitalWrite(led7,HIGH); delay(sure); digitalWrite(led7,LOW); digitalWrite(led6,HIGH); delay(sure); digitalWrite(led6,LOW); digitalWrite(led5,HIGH); delay(sure); digitalWrite(led5,LOW); digitalWrite(led4,HIGH); delay(sure); digitalWrite(led4,LOW); digitalWrite(led3,HIGH); delay(sure); digitalWrite(led3,LOW); digitalWrite(led2,HIGH); delay(sure); digitalWrite(led2,LOW); }