attachInterrupt Help!

Hello there.

I'm using attachInterrupt(0, funct, FALLING) to call on the function funct every time my photoresistor detects a light source. (I have holes on a track and my stage is moving down the track, and signalling everytime it reaches a hole). However, whenever my track enters a hole (Falling) or exits a hole (rising) the function is called, which means its pretty much calling my function everytime there is a state change. Has anyone else seen this problem before? Any insight would be useful. Thanks!

It might be helpful to see your wiring of your sensor. I suspect your not getting a nice digital transition but rather a relatively slow moving analog transition. A analog sensor makes a poor digital sensor without external help like a comparator or something, otherwise you get something almost the same as switch bouncing symptoms.


I hooked it up to an oscilliscope and I was getting some high frequency ringing, so rising currents have falling components in it and vice versa. I'm working on the hardware to slow down the transition and get rid of those high frequency components.