Skip to content

Instantly share code, notes, and snippets.

@hdurdle
Last active August 29, 2015 14:12
Show Gist options
  • Save hdurdle/3f0b0908cc77d6a6e9a3 to your computer and use it in GitHub Desktop.
Save hdurdle/3f0b0908cc77d6a6e9a3 to your computer and use it in GitHub Desktop.
Arduino RGB test
#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