Hello, I am working on my first arduino project, trying to detect rotational motion on a 3D Printer filament spool. I am using an arduino micro, and have basically set up a circuit with a pololu optical distance sensor that acts as a switch when triggered by a reflective material (white versus black). The code for that part is a the basic Digital Read Serial which I found here under the learning section, and have been able to test my distance sensor with.
My plan is to have a pie-like chart with "wedges" of alternating black and white which will be fastened to the filament spool which is supposed to be rotating. The white sections will reflect resulting in a "0", everything else is just a "1". When the filament spool is empty or a jam stops it from moving, I want to be able to notice that the signal doesn't switch from a high to a low (0 to 1 on the readout), and then activate a LED after a predetermined time, perhaps 5-10 seconds.
The part that I'm not sure about is setting up a timer to count when the change from high to low occurs, and consequently turn the LED on if the prescribed time elapses without it switching back.
If anybody has coded something like this or would have any ideas on how to do it I would really appreciate it.
Thanks, Jesse Kaiser