apuntes_Arduino/leds/rgb3/rgb3.ino
2022-04-04 17:41:38 -04:00

55 lines
1019 B
C++
Executable File

byte green = 4;
byte blue = 3;
byte red = 2;
int wait = 4000;
void setup() {
pinMode(green,OUTPUT);
pinMode(blue,OUTPUT);
pinMode(red,OUTPUT);
}
void secu1(int r) {
while (r>0) {
digitalWrite(green,1);
delay(wait);
digitalWrite(green,0);
digitalWrite(red,1);
delay(wait);
digitalWrite(red,0);
digitalWrite(blue,1);
delay(wait);
digitalWrite(blue,0);
--r;
}
}
void secu2(int r) {
while (r>0){
digitalWrite(blue,0);
digitalWrite(red,1);
delay(wait);
digitalWrite(green,0);
digitalWrite(blue,1);
delay(wait);
digitalWrite(red,0);
digitalWrite(green,1);
delay(wait);
--r;
}
}
void loop() {
//secu1(4);
//secu2(4);
digitalWrite(green,0);
digitalWrite(red,1);
delay(wait);
digitalWrite(blue,1);
digitalWrite(red,0);
delay(wait);
digitalWrite(green,1);
digitalWrite(blue,0);
delay(wait);
}