I have a tone coming in to the arduino on pin 2 (Int 0). I am measuring the frequency and then converting that to a command. The tones are pre-shaped to 5V square waves and are not analog.
These tones are coming in from a radio receiver and are being sent from a remote control. So the commands could come in at any time and there is going to be long periods with no command coming in. So moving my routine to an interrupt is desired if possible.
However, this being the output of a radio receiver, I have to deal with noise, which means the interrupt is almost constantly being triggered.
And of course, being a tone with a continuous frequency while the remote button is being pressed, I am also going to trigger on every rising edge (which means thousands of times a second.) And what I really want is just to know what button was pressed and then act on that command in my loop (if valid).
So given the above, is using an interrupt in this scenario even feasible at all?
The application is a robot. And for example, four of the tones will control the steering of the robot. So I also need to know if the button is being held down to continue to drive in a direction. When there is no command from the remote, I want the robot to be doing robot things on its own.
I am thinking that a polling method might be more appropriate? Just wanted to get some thoughts.
I can post the code that I want to put in an interrupt if it will help, but I think the question is maybe generic enough?