Created
February 22, 2019 21:15
-
-
Save davidleandro/a3087462a9cb1dfaa7d7805ee3d60604 to your computer and use it in GitHub Desktop.
LED RGB Arduino
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
const int pin_verm = 10; | |
const int pin_verd = 9; | |
const int pin_azul = 8; | |
int verm = 255; | |
int verd = 0; | |
int azul = 0; | |
int tempo = 10; | |
void setup() { } | |
void loop() { | |
/* vermelho -> azul */ | |
for (/* ignore */; verm>=0, azul<255; azul++, verm--) { | |
analogWrite(pin_verm, verm); | |
analogWrite(pin_azul, azul); | |
delay(tempo); | |
} | |
/* azul -> verde */ | |
for (/* ignore */; azul>=0, verd<255; verd++, azul--) { | |
analogWrite(pin_azul, azul); | |
analogWrite(pin_verd, verd); | |
delay(tempo); | |
} | |
/* verde -> vermelho */ | |
for (/* ignore */; verd>=0, verm<255; verm++, verd--) { | |
analogWrite(pin_verd, verd); | |
analogWrite(pin_verm, verm); | |
delay(tempo); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment