งานที่ 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);
} 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);
}
}
ความคิดเห็น
แสดงความคิดเห็น