Skip to content

Instantly share code, notes, and snippets.

@navillus5
Last active December 23, 2015 12:08
Slight modification of the Arduino Blink sketch
/*
BlinkTwo
Turns two LEDs on and off in unison.
The delay times are controlled by two variables
that are defined at the beginning of the program.
This example code is in the public domain.
*/
// Use the LEDs that are connected to I/O pins 12 and 13
int led1 = 12;
int led2 = 13;
// Set delay values for the amount of time the LEDs
// are on and the amount of time they are off.
int onTime = 100;
int offTime = 250;
// the setup routine runs once when you press reset:
void setup() {
// initialize the digital pins as outputs.
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
digitalWrite(led1, HIGH); // turn the LED on
digitalWrite(led2, HIGH);
delay(onTime); // wait for a bit
digitalWrite(led1, LOW); // turn the LED off
digitalWrite(led2, LOW);
delay(offTime); // wait for a bit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment