I have the following problem
i got a photoresistor and 2 LED's; one LED is supposed to be on when the photoresistor isn't blocked. i want the other LED to be on when the photoresistor is blocked. after some time of searching i didn't even find a hint how my code hast to look like to realize this special kind of setup
here is the code i'm using now and which is working for one LED being on while the photoresistor isn't blocked
The original code will be "true" unless the sensor is in the very very dark (or light, depends on your circuit) if (analogRead(lightPin)) {should be
if (analogRead(lightPin) > 500) {
Pick any value between 1 and 1023 to be the trigger value.
(If you are not using Serial. elsewhere in the code then you do not need the Serial.begin in the setup)