Open suthiporn opened 6 years ago
#Lab2.txt
อธิบายหลัการทำงาน ทำการเชื่อมต่อหลอดไฟ LED 3 ดวง แล้วเขียน Code เพื่อให้ไฟสลับกันไปสลับกันมา Source code int timer = 100 ; void setup() { for(int thispin = 5; thispin<8; thispin++) { pinMode(thispin, OUTPUT) ; } } void loop() { for(int thisPin = 5; thisPin<8; thisPin++){ digitalWrite(thisPin,HIGH) ; delay(timer) ; digitalWrite(thisPin,LOW) ; } for(int thisPin = 7; thisPin<5; thisPin--){ digitalWrite(thisPin,HIGH) ; delay(timer) ; digitalWrite(thisPin,LOW) ; } }