Created
June 6, 2020 19:20
-
-
Save pyxn/2b52fdce150e295095968c484a8636b6 to your computer and use it in GitHub Desktop.
Arduino Uno - Makes 2 LEDs blink alternatively for 1 second
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
int pin1Led = 4; | |
int pin2Led = 5; | |
void setup() { | |
pinMode(pin1Led, OUTPUT); | |
pinMode(pin2Led, OUTPUT); | |
} | |
void loop() { | |
setLed(HIGH, LOW); | |
setLed(LOW, HIGH); | |
delay(240); | |
} | |
void setLed(int outputA, int outputB) { | |
digitalWrite(pin1Led, outputA); | |
if (outputA == HIGH) { | |
digitalWrite(pin2Led, LOW); | |
} else { | |
digitalWrite(pin2Led, HIGH); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment