//Codigo Arduino
//lAB 3
//Crhistian David Lucumi
//Usc
//Version 1.0
int valor=0;
#define MAX 9
int led[MAX]={
2, 3 , 4, 5, 6, 7, 8, 9,10};
int t_off=500;
int t_on=100;
void setup(){
Serial.begin(9600);
for(int pin=0; pin<=MAX;pin++){
pinMode(led[pin], OUTPUT);
}
}
void loop(){
if (Serial.available()>0){
valor=Serial.read();
if (valor=='O'){
t_on=Serial.parseInt();
}
if (valor=='F'){
t_off=Serial.parseInt();
}
}
for (int pin =0; pin <= MAX; pin++){
prender(led[pin], t_on);
apagar(led[pin], t_off);
}
for (int pin =MAX; pin >= 0; pin--){
prender(led[pin], t_on);
apagar(led[pin], t_off);
}
}
void prender(int le, int tem){
digitalWrite(le, HIGH);
delay(tem);
}
void apagar(int le, int tem){
digitalWrite(le, LOW);
delay(tem);
}