suthiporn / iot

0 stars 0 forks source link

#Lab2 #9

Open suthiporn opened 6 years ago

suthiporn commented 6 years ago

2 #Lab2.txt

suthiporn commented 6 years ago

อธิบายหลัการทำงาน ทำการเชื่อมต่อหลอดไฟ 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) ; } }