01-13-2013 11:28 PM
I am currently trying to measure the speed of a cog for a set period of time. I have wired a sensor back to an analog input. I am reading this single channel inside a while loop for five seconds and based on the number of pulses I multiply this value by 12 to get revs per minute. The problem is at the minute I can't seem to get it to run consistently giving out the same value each time. I know what I need to add but am unsure of what code to use. Basically when the sensor senses the notch it drops to 0.2 volts and the rest of the time it sits at Volts. I want to monitor this input at five volts and only start counting the pulses when I see it going to 0.2 volts i.e.. Sensing the notch again. Would anyone be able to point me in the right direction with this one?
Thanks.
01-14-2013 01:08 AM
I have added an attachment of what I have so far so if anyone else has any ideas feel free to reply.
Thanks again.
01-14-2013 04:36 AM
One simple solution is to add an extra loop before your measuring, measuring until voltage >0.2, then starting the other loop.
/Y