Josh Lopez-Binder, kitt leds
code:
int ledPins[] = {13,12,11,10,9,8,7,6,4,3};
int numLeds = 10;
int sensorValue = 0;
int sensorPin = A0;
void setup(){
for(int i = 0; i < numLeds; i++){
pinMode(ledPins[i], OUTPUT);
}
}
void loop(){
for(int i = 0; i <numLeds; i++){
sensorValue = analogRead(sensorPin);
int delayTime = sensorValue;
digitalWrite(ledPins[i], HIGH);
delay(delayTime);
digitalWrite(ledPins[i], LOW);
}
for(int i = numLeds-1; i >=0; i--){
sensorValue = analogRead(sensorPin);
int delayTime = sensorValue;
digitalWrite(ledPins[i], HIGH);
delay(delayTime);
digitalWrite(ledPins[i], LOW);
}
}