Created
January 2, 2021 06:07
-
-
Save yukilabo/16addc16b57400bfff2704653cc7e0b1 to your computer and use it in GitHub Desktop.
traffic_signal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define PIN_GREEN 0 | |
#define PIN_YELLOW 4 | |
#define PIN_RED 2 | |
#define PIN_GND 1 | |
void setup() { | |
// put your setup code here, to run once: | |
pinMode(PIN_GREEN, OUTPUT); | |
pinMode(PIN_GND, OUTPUT); | |
pinMode(PIN_YELLOW, OUTPUT); | |
pinMode(PIN_RED, OUTPUT); | |
analogWrite(PIN_GND, 100); | |
digitalWrite(PIN_YELLOW, LOW); | |
} | |
void loop() { | |
// put your main code here, to run repeatedly: | |
digitalWrite(PIN_RED, LOW); | |
digitalWrite(PIN_GREEN, HIGH); | |
delay(20000); | |
digitalWrite(PIN_GREEN, LOW); | |
digitalWrite(PIN_YELLOW, HIGH); | |
delay(3000); | |
digitalWrite(PIN_YELLOW, LOW); | |
digitalWrite(PIN_RED, HIGH); | |
delay(15000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment