I am interfacing a photoelectric switch with Arduino, an interrupt is to occur when there is a transition of the state on the switch. The problem is that when the transition occurs more than one interrupt occurs per transition. Has anyone ever had such problems?
Has anyone ever had such problems?
Yes, of course. It's called switch bounce.
Do you really need an interrupt? Mechanical switches rarely merit one because they're so slooow..
The sensing element is a photoelectric switch it is a sort of open collector BJT.
could it be that your switch is detecting faster than you expect it? if you are sensing something like fluorescent lights you might be detecting the 60hz pulse. more information is needed
Could it be that your switch does not behave digital but analog and thus causes the Arduino to flip back and forth while the switch is in transition?