This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
knightrider [2019/07/16 19:43] 127.0.0.1 external edit |
knightrider [2019/10/07 17:21] (current) leo |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| //Coche fantastico con 6 LEDS | //Coche fantastico con 6 LEDS | ||
| - | #define ROJO1 2 | + | #define LEDINICIO 14 |
| - | #define AMARILLO1 3 | + | #define LEDFIN 19 |
| - | #define VERDE1 4 | + | |
| - | #define ROJO2 5 | + | |
| - | #define AMARILLO2 6 | + | |
| - | #define VERDE2 7 | + | |
| int i; | int i; | ||
| void setup() { | void setup() { | ||
| - | pinMode(ROJO1,OUTPUT); | + | for(i=LEDINICIO,i<=LEDFIN;i++) |
| - | pinMode(AMARILLO1,OUTPUT); | + | pinMode(i,OUTPUT); |
| - | pinMode(VERDE1,OUTPUT); | + | |
| - | pinMode(ROJO2,OUTPUT); | + | |
| - | pinMode(AMARILLO2,OUTPUT); | + | |
| - | pinMode(VERDE2,OUTPUT); | + | |
| } | } | ||
| void loop() { | void loop() { | ||
| //Recorre luces | //Recorre luces | ||
| - | for(i=2;i<8;i++){ | + | for(i=LEDINICIO;i<=LEDFIN;i++){ |
| digitalWrite(i,HIGH); | digitalWrite(i,HIGH); | ||
| delay(100); | delay(100); | ||
| Line 30: | Line 22: | ||
| } | } | ||
| //Recorre luces reversa | //Recorre luces reversa | ||
| - | for(i=6;i>2;i--){ | + | for(i=LEDFIN;i>=LEDINICIO;i--){ |
| digitalWrite(i,HIGH); | digitalWrite(i,HIGH); | ||
| delay(100); | delay(100); | ||