1
0
Fork 0
unlondon-workshops/sketchbook/Blink-RGB/Blink-RGB.ino

37 lines
917 B
Arduino
Raw Permalink Normal View History

2016-05-20 15:00:36 -04:00
/*
RGB Blink
Alternates R, G and B LED on for one second, then off for one second, repeatedly.
This example code is in the public domain.
modified 20 May 2016
by Shawn Nock
*/
#define RED 6
#define GREEN 5
#define BLUE 3
2016-05-23 20:48:26 -04:00
#define DELAY_MS 1000 // How long to keep LEDs on and off in milliseconds (sec/1000)
2016-05-20 15:00:36 -04:00
void setup() {
// initialize digital pin 13 as an output.
pinMode(RED, OUTPUT);
pinMode(GREEN, OUTPUT);
pinMode(BLUE, OUTPUT);
}
void loop() {
digitalWrite(RED, HIGH); // turn the LED on (HIGH is the voltage level)
2016-05-23 20:48:26 -04:00
delay(DELAY_MS); // wait for a second
2016-05-20 15:00:36 -04:00
digitalWrite(RED, LOW); // turn the LED off by making the voltage LOW
2016-05-23 20:48:26 -04:00
delay(DELAY_MS); // wait for a second
2016-05-20 15:00:36 -04:00
digitalWrite(GREEN, HIGH);
2016-05-23 20:48:26 -04:00
delay(DELAY_MS);
2016-05-20 15:00:36 -04:00
digitalWrite(GREEN, LOW);
2016-05-23 20:48:26 -04:00
delay(DELAY_MS);
2016-05-20 15:00:36 -04:00
digitalWrite(BLUE, HIGH);
2016-05-23 20:48:26 -04:00
delay(DELAY_MS);
2016-05-20 15:00:36 -04:00
digitalWrite(BLUE, LOW);
2016-05-23 20:48:26 -04:00
delay(DELAY_MS);
2016-05-20 15:00:36 -04:00
}