Hi, I try to use Arduino for my home automation and have a little problem to solve. I made a chicken food dispenser and works like a revolver. A motor turns a drum with 4 tubes. In those tubes is placed the food (1 tube /Day). Every day, say at 07:00 o’clock the device turns ¼ turn and feeds the chickens. I have a 220V clock which I can set daily at 07:00 (15 minutes is smallest time lapse I can set). This “Signal” goes to 1 Digital input of Arduino. Than, I put a switch on the position where the tubes have to Stop and 4 screws on the revolver Drum where I want the Tube to Stop (Position). Every time that the screw reaches the switch, the switch goes to 1 (normally open). My question: The next day the switch is still 1 so that I can’t “Tell” to Arduino to stop as soon as the switch goes to 1. Has any of you a solution to solve this inconvenient? Thank you so much for your help.
At trigger time, start the motor. Monitor the switch until it reads zero. Delay a few milliseconds to take care of switch bounce. Monitor the switch until it reads one. Stop the motor.