Go Down

Topic: Press or release button interrupt from multiplexer (Read 830 times) previous topic - next topic

90ender

I have an arduino Leonardo project with multiple buttons going through a 4051 mux/demux and rather than continuously polling them, I would like to send an interrupt whenever a button has been pressed or released, telling the sketch to check the buttons and find which one changed. I have seen some examples of how to use diodes to signal the pin if a button has been pressed, but not with a multiplexer and not if pressed OR released. I imagine that being able to detect both conditions with multiple buttons may be a problem.

Any ideas?

septillion

It is possible as long as only one button at a time is pressed ALL THE TIME. Then you can indeed OR all button signals and check that changing state. But that's not a condition I would like in a control panel...

Other option would be to use a port expander like the PCF8574 which has a interrupt line.
Use fricking code tags!!!!
I want x => I would like x, I need help => I would like help, Need fast => Go and pay someone to do the job...

NEW Library to make fading leds a piece of cake
https://github.com/septillion-git/FadeLed

90ender

Yeah, the only one button at a time, limit is exactly the problem that I am running into. The port expander sounds like something to look into though. I'll go dig up some datasheets and see if it could solve the issue.

Meanwhile, if anyone else has any suggestions I'm all ears. This just seems like a common issue where multiple buttons are concerned, you would think there would be a more standard answer.

Smajdalf

I think IO expander is "more standard answer" for multiple buttons than (de)mux. Mostly because you can read all buttons at once, use it also as an output etc.
How to insert images: https://forum.arduino.cc/index.php?topic=519037.0

Go Up