Created
March 25, 2020 06:13
-
-
Save jpliew/2507a04c42a313668cfd398084b632d4 to your computer and use it in GitHub Desktop.
Tutorial 3 - 1C
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
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