Hello, I am LinktheInventor, and I would like to know if there is code out there to make a Hobby Servo run by the Photo Resistor ( I hope that makes sense).
I am using the Arduino Uno (which I got with the Adafruit ARDX - v1.3 Experimentation Kit for Arduino (Uno R3) - v1.3), and I don't know much code. I wan't this combination to do this:
1.The light gets below a certain level.
2. The photo resistor "reads" the light and sends a "signal" to the Hobby Servo, which closes a door. ( Pet cages is what I am mostly thinking of)
Not sure exactly what you mean, no.... But here's what I did a while ago: I mounted an LDR on the horn of a servo, and coded it so that if the LDR was in the dark, the servo would start sweeping until it was in the light and then it would stop. Is that the kind of thing you mean?
You won't get full code for a school project supplied here, since you're supposed to be learning, but here's a couple of links to save you searching. Here is how to read an LDR, and here is how to run a servo.
Leave it to you figure out how to combine the two....
This code might work. I don't have time to test it. This will at least give you a place to start. As for his school project this code is PART of it. I'm sure he will add to it.
You sure you should be doing that for a someone's school project, Drew?
I understand that it is my project, but I just have some questions that me (and my family) can't answer (we have basic understanding of it,but we are willing to learn). Thanks for the link though!
Also after rereading your post it appears that you want to make the door close after a certain level of light is reached. If that is the case tell us and I (or you) can adapt the code.
The door closing is a good project, since it will be interesting mechanically too- the angles of linkages etc to get it close smoothly etc etc.
One question.... how will you make sure the inhabitants are on the right side of the door?... or even more important, not getting jammed in the closing door?