초록 -> 노랑 -> 빨강 순서로 켜지고, 빨강 -> 노랑 -> 초록 순서로 끄기
void setup() {
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
}
초록 -> 노랑 -> 빨강 신호등 만들기
void setup() {
pinMode(11, OUTPUT);
pinMode(12, OUTPUT);
pinMode(13, OUTPUT);
}
void loop() {
digitalWrite(11, HIGH);
delay(1000);
digitalWrite(11, LOW);
delay(1000);
digitalWrite(12, HIGH);
delay(1000);
digitalWrite(12, LOW);
delay(1000);
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}