Last active
December 28, 2021 23:10
-
-
Save rdeprey/a1cdae2d609214215d2c5005d338ee35 to your computer and use it in GitHub Desktop.
Arduino Sketch for Blinking Strands of LEDs
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
// Set which pin each strand of lights is connected to | |
int lightStrand1 = A4; | |
int lightStrand2 = 3; | |
// Runs once | |
void setup() { | |
// Set strands as outputs | |
pinMode(lightStrand1, OUTPUT); | |
pinMode(lightStrand2, OUTPUT); | |
// Initialize Serial, set the baud rate to 9600 bps | |
Serial.begin(9600); | |
} | |
void loop() { | |
// Pauses the loop for 1.5 seconds | |
delay(1500); // milliseconds | |
// Setting lightStrand1 to HIGH turns ON the LEDs connected to pin A4 | |
// Setting lightStrand2 to LOW turns OFF the LEDs connected to pin 3 | |
digitalWrite(lightStrand1, HIGH); | |
digitalWrite(lightStrand2, LOW); | |
// Pauses the loop for 1.5 seconds | |
delay(1500); // milliseconds | |
// Setting lightStrand1 to LOW turns OFF the LEDs connected to pin A4 | |
// Setting lightStrand2 to HIGH turns ON the LEDs connected to pin 3 | |
digitalWrite(lightStrand1, LOW); | |
digitalWrite(lightStrand2, HIGH); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment