apuntes_Arduino/leds/rgb/rgb.ino

48 lines
1.0 KiB
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
int LedRojo = 4;
int LedAzul = 3;
int LedVerde = 2;
void setup() {
2022-04-04 17:41:38 -04:00
pinMode(LedRojo, OUTPUT);
pinMode(LedAzul, OUTPUT);
pinMode(LedVerde, OUTPUT);
2021-01-05 00:15:16 -03:00
}
void secuencia1(int x) {
2022-04-04 17:41:38 -04:00
while(x>0) {
x--;
digitalWrite(LedRojo, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LedAzul, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
digitalWrite(LedVerde, HIGH);
delay(100);
digitalWrite(LED_BUILTIN, LOW);
}
2021-01-05 00:15:16 -03:00
}
void secuencia2(int u) {
2022-04-04 17:41:38 -04:00
while(u>0) {
u--;
digitalWrite(LedRojo, HIGH);
//digitalWrite(LedAzul, LOW);
digitalWrite(LedVerde, LOW);
delay(3000);
digitalWrite(LedRojo, LOW);
digitalWrite(LedAzul, HIGH);
//digitalWrite(LedVerde, LOW);
delay(3000);
//digitalWrite(LedRojo, LOW);
digitalWrite(LedAzul, LOW);
digitalWrite(LedVerde, HIGH);
delay(3000);
}
2021-01-05 00:15:16 -03:00
}
void loop() {
2022-04-04 17:41:38 -04:00
secuencia2(5);
//secuencia1(2);
}