hello im brand new to arduino and ive been tasked with creating a code that makes 6 LEDs run a knight rider circuit with the speed depending on the value of the photocell. it was working fine before i put in the photocell but now it just keeps all lights on.
heres my code
const int sensorMin = 50;
const int sensorMax = 200;
int photocellPin = A0;
int timer = analogRead(photocellPin);
void setup()
{
for (int thisPin = 2; thisPin < 8; thisPin++)
{
pinMode(thisPin, OUTPUT);
}
}
void loop()
{ for (int thisPin = 2; thisPin < 8; thisPin++)
{
digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW);
}
for (int thisPin = 7; thisPin < 1; thisPin--)
{
digitalWrite(thisPin, HIGH);
delay(timer);
digitalWrite(thisPin, LOW);
}
}