Using motor with a photoresistor HELPPP

Hi! I need to know how to make a motor to move in a constant direction with the aid of a photoresistor. the idea is that when you use it the motor changes the direction. I dont really know how to do the code and the connections in the arduino.

If you could help me, I would be pleased.


You mean if the sensor reads "dark" rotate one way, and if "light" rotate the other?

Anyway, here is a tutorial on how to use a photoresistor.

To reverse a motor, you need an h-bridge. Here is a tutorial on that... where they talk of reading a switch to reverse direction, that's where your photoresistor comes in. It's basically light or dark, on or off.

Hope that helps to get you started?- Welcome to Arduino!