Last active
August 29, 2015 14:12
-
-
Save hdurdle/3f0b0908cc77d6a6e9a3 to your computer and use it in GitHub Desktop.
Arduino RGB test
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
#define REDPIN 3 | |
#define GREENPIN 5 | |
#define BLUEPIN 6 | |
void setup () | |
{ | |
Serial.begin(57600); | |
pinMode(REDPIN, OUTPUT); | |
pinMode(GREENPIN, OUTPUT); | |
pinMode(BLUEPIN, OUTPUT); | |
} | |
void loop () | |
{ | |
setColor(255,0,0); | |
delay(1000); | |
setColor(0,255,0); | |
delay(1000); | |
setColor(0,0,255); | |
delay(1000); | |
} | |
void setColor(int r, int g, int b){ | |
analogWrite(REDPIN, r); | |
analogWrite(GREENPIN, g); | |
analogWrite(BLUEPIN, b); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment