Skip to content

Instantly share code, notes, and snippets.

@rdeprey
Last active December 28, 2021 23:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rdeprey/a1cdae2d609214215d2c5005d338ee35 to your computer and use it in GitHub Desktop.
Save rdeprey/a1cdae2d609214215d2c5005d338ee35 to your computer and use it in GitHub Desktop.
Arduino Sketch for Blinking Strands of LEDs
// 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