Detecting 120v

Hello, folk's!

I have a arduino controling a motor! I have a 7day programable timer, that replaces a light switch. I want to use this to " trigger" the arduino to run the 12v motor until it hits a limit switch. When the timer shuts off, i want the arduino to reverse the motor until it hits a limit switch. I have the motor control stuff all figured out, and working.

Question is: What is the easiest/best way to detect the 120v on/off?

thanks, JR

What is the easiest/best way to detect the 120v on/off?

A wet finger tip.

Question is: What is the easiest/best way to detect the 120v on/off?

Have you considered a relay?

easy/best

I figured that would come as a two part answer! Just use to timer to turn on an outlet into which i plug a five volt wall wart, which when turned on sends signal. OK.

Maybe a 9v wart i have with a 7805 regulator, to smooth out the wrinkles.

cool! Any other great ideas? JR

Here's an idea using an optisolator:

Enable the pullup on the digital input and it will go low once every 16.7ms. You can detect it by connecting it to an interrupt pin, or a pin-change interrupt, etc.

-- The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

Enable the pullup on the digital input and it will go low once every 16.7ms

...in some parts of the world.