Skip to content

Instantly share code, notes, and snippets.

@jpliew
Created March 25, 2020 06:13
Show Gist options
  • Save jpliew/2507a04c42a313668cfd398084b632d4 to your computer and use it in GitHub Desktop.
Save jpliew/2507a04c42a313668cfd398084b632d4 to your computer and use it in GitHub Desktop.
Tutorial 3 - 1C
int pinR = 10;
int pinG = 9;
int pinB = 11;
void setup() {
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
}
void RGBLed(int R, int G, int B) {
analogWrite(pinR, R);
analogWrite(pinG, G);
analogWrite(pinB, B);
}
void loop() {
RGBLed(255,0,0); // RED
delay(2000);
RGBLed(255,50,0); // YELLOW
delay(500);
RGBLed(0,255,0); // GREEN
delay(2000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment