AnalogIn and InterruptIn on the same pin?

16 Nov 2015

I have tried to use AnalogIn and InterruptIn on the same pin on the LCP11u24 (PIO0_11), however it does not seem to work. Is there any way to dynamically change the function of a pin so that it can switch from acting like an analog input to then acting like a interrupt input. Any help appreciated!

18 Nov 2015

I can only guess that you may be trying to do something like use the analog input to meter an input and give a set point notification. It seems like you need to do a test to see if the value is more than or less than a desired value each time you read the value. You can set low or high values for the set points. You can do things like read the input several times and average them together before you test to dampen the movement between tests if the reading is too erratic. Hope this helps.

18 Nov 2015

You can make a new AnalogIn if you want that, and afterwards make an InterruptIn if you want that.

To have them at the same time, you might have a chance if you first set it as InterruptIn and then as AnalogIn, but maybe you already tried that order.

20 Nov 2015

Can you give us a better description of what you wish to accomplish with this circuit or program? We could help better with more info on the problem. Dontheone