For a school project i wanna control a Servo with a photoresistor. My problem is that i want the servo be at the one or the other end depending on the photoresistor. it's kinda like if and else.
That's the scheme i got in mind: Photoresistor blocked -> servo is at one ende; photoresistor not blocked -> servo is at the other end.
hope you guys can help me with this pretty easy thing... im not into coding that much, i like to build things not program them =)
Except that a photoresistor is an analog device. Replace digitalRead with analogRead, after connecting the photoresistor to an analog pin, and the "== LOW" with ">= threshold". Define threshold however you wish to make the servo move at the appropriate light level.