Led Array in combo with Button Array

Help creating logic scripts for Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Led Array in combo with Button Array

#1 Post by Mike Horsten »

HI, I was looking for a solution to have a button array and have a led with the button that is turrend on.
This would be useful for a button box that tells me what is on and what is off. just by looking at the led.

the code i have would use a 4x4 matrix but the leds would consume 16 pins on the Arduino plus the 8 for the buttons. Making it no possible on a NANO (20) or a Raspberry Pico would leave one pin left. Any ways to do this? Or is the mega the only solution. Binding the led to the switch is not possible as they are push buttons not fixed switches.

MIke

PS a Multiplexer or DM16chip would solve the issue
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Led Array in combo with Button Array

#2 Post by Sling »

There are a few ways to do this. Using message port the options are plentiful but if you don’t want to get into message port then you can also multiplex the LED’s using the standard API digital in and out functions.

Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: Led Array in combo with Button Array

#3 Post by Mike Horsten »

Sling wrote: Fri Apr 30, 2021 6:01 am There are a few ways to do this. Using message port the options are plentiful but if you don’t want to get into message port then you can also multiplex the LED’s using the standard API digital in and out functions.
Can you explain the multiplexing with the digital API?
I already use the digital out for one command to switch between two leds red and green and a button, so the button gets pressed, the red led goes on, if i press the button again the green turns on and red off, but i still need 3 pins to do this one for the button and each led gets one. As per the question it only needs to go on and off with ONE button so there are only two pins per button (led and button) but i need about 16 buttons with LED's if you know a way to lower the pin count that would be great.

Mike
PS buttons used are the 12x12mm simple tactile buttons.
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

User avatar
Keith Baxter
Posts: 4674
Joined: Wed Dec 20, 2017 11:00 am
Location: Botswana

Re: Led Array in combo with Button Array

#4 Post by Keith Baxter »

AMD RYZEN 9 5950X CPU, Corsair H80I cooler, ASUS TUF GAMING B550-PLUS AMD Ryzen Mother Board,  32Gb ram Corsair Vengeance 3000Mh, MSI GTX960 4G graphics card 

User avatar
Sling
Posts: 5237
Joined: Mon Sep 11, 2017 2:37 pm
Contact:

Re: Led Array in combo with Button Array

#5 Post by Sling »

Exactly that. You will need 4 transistors to turn on the common cathodes unless you keep the led current low enough so an Arduino can drive 4 LED’s at once without risk of damage.

Some may say that the timing is important here and they would be right but in my experience for this number of LED’s it should be no issue. I managed this with raw 7 segment displays and no special driver way back using just AM and a few basic components. I was just testing the capabilities of AM but it was a useful and successful test.

Tony

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Led Array in combo with Button Array

#6 Post by jph »

Probably not what you are absolutely looking for but ---I always found this fun to play with, even though it was years ago, A forgotten art.

https://en.wikipedia.org/wiki/Charliepl ... ltiplexing.
Joe
Joe. CISSP, MSc.

Mike Horsten
Posts: 79
Joined: Tue Dec 01, 2020 8:50 am

Re: Led Array in combo with Button Array

#7 Post by Mike Horsten »

Thanks guys for all the help but ill use a Mega for this as there are too many variables. Loved the videom but that does not help much but thanks @Keith.

Is there a repository for code somewhere, like a sample code for a button array. I fail to find it. What i need is how to pull the correct value from the array.
Explain: if i have an array of say 2,2 i have 4 buttons. How i know that Air manager will tell me what button is pressed if i ask via the wiki example, but how to translate that to a specific command for a specific button is unclear to my mind.

Any help is appreciated.
Building a home Cessna 172SP Steam. X-plane/MFS2020
(ex Name on Airmanager forum Polarair)

Post Reply