48 lines
912 B
Arduino
48 lines
912 B
Arduino
|
int LedRojo = 4;
|
||
|
int LedAzul = 3;
|
||
|
int LedVerde = 2;
|
||
|
|
||
|
void setup() {
|
||
|
pinMode(LedRojo, OUTPUT);
|
||
|
pinMode(LedAzul, OUTPUT);
|
||
|
pinMode(LedVerde, OUTPUT);
|
||
|
}
|
||
|
|
||
|
void secuencia1(int x) {
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void secuencia2(int u) {
|
||
|
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);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void loop() {
|
||
|
secuencia2(5);
|
||
|
//secuencia1(2);
|
||
|
}
|