apuntes_Arduino/leds/PWM_x2/PWM_x2.ino

68 lines
1.5 KiB
Arduino
Raw Normal View History

2021-01-05 00:15:16 -03:00
#define led_Azl 6
#define led_Rjo 5
#define pausa 100
byte cont;
void setup() {
pinMode(led_Azl, OUTPUT);
pinMode(led_Rjo, OUTPUT);
byte cont = 0;
}
void loop() {
/*
analogWrite(led_Azl, 50);
analogWrite(led_Rjo, 255);
delay(pausa);
analogWrite(led_Azl, 70);
analogWrite(led_Rjo, 235);
delay(pausa);
analogWrite(led_Azl, 90);
analogWrite(led_Rjo, 215);
delay(pausa);
analogWrite(led_Azl, 110);
analogWrite(led_Rjo, 195);
delay(pausa);
analogWrite(led_Azl, 130);
analogWrite(led_Rjo, 175);
delay(pausa);
analogWrite(led_Azl, 150);
analogWrite(led_Rjo, 155);
delay(pausa);
analogWrite(led_Azl, 170);
analogWrite(led_Rjo, 115);
delay(pausa);
analogWrite(led_Azl, 190);
analogWrite(led_Rjo, 95);
delay(pausa);
analogWrite(led_Azl, 210);
analogWrite(led_Rjo, 80);
delay(pausa);
analogWrite(led_Azl, 230);
analogWrite(led_Rjo, 70);
delay(pausa);
analogWrite(led_Azl, 255);
analogWrite(led_Rjo, 50);
delay(300);
*/
for (byte r = 40; r < 255; r++) {
byte a = (295 - r);
analogWrite(led_Rjo, r);
analogWrite(led_Azl, a);
delay(3);
}
delay(2000);
for (byte a = 255; a > 40; a--) {
byte r = (295 - a);
analogWrite(led_Azl, r);
analogWrite(led_Rjo, a);
delay(3);
}
delay(2000);
cont++;
// if (cont < 20) {
// delay(5000);
// cont = 0;
// }
}