งานที่ 2


void setup() {
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(4, INPUT);
}
void loop() {
  buttonState = digitalRead(4);
  if (buttonState == LOW
) {
    digitalWrite(13, HIGH); 
    delay(200);                 
    digitalWrite(12, LOW);   
    delay(200);
    digitalWrite(12, HIGH); 
    delay(200);                 
    digitalWrite(13, LOW);   
    delay(200);    
  } else {
    digitalWrite(13, LOW);
    digitalWrite(12, LOW);
  }
}
void setup() {
  pinMode(13,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(4, INPUT);
}
void loop() {
  buttonState = digitalRead(4);
  if (buttonState == HIGH) {
    digitalWrite(13, HIGH); 
    delay(200);                 
    digitalWrite(12, LOW);   
    delay(200);
    digitalWrite(12, HIGH); 
    delay(200);                 
    digitalWrite(13, LOW);   
    delay(200);    
  } else {
    digitalWrite(13, LOW);
    digitalWrite(12, LOW);
  }
}

ความคิดเห็น

โพสต์ยอดนิยมจากบล็อกนี้

https://www.arduitronics.com/article/22/arduino-and-motor-control-part-1

https://medium.com/sathittham/arduino-lcd-16x2-hello-world-dca09fd904f8

อธิบายโปรแกรมHow To Make Arduino Based Home Automation Project via Bluetooth