Momentary push button - can i latch?

Questions about deployment and use of Air Manager Instruments

Moderators: russ, Ralph

Post Reply
Message
Author
jonesy1991
Posts: 3
Joined: Thu Aug 05, 2021 1:32 pm

Momentary push button - can i latch?

#1 Post by jonesy1991 » Thu Aug 05, 2021 1:38 pm

hello,

i am starting my build of a AS350, i have found what i think are a great match for the switches on the main swith panel. these are momentary with a led inside. i can find the same swith as a latching version so my question is. how if possible can i make air manager see each press as a alternating command?

(off) - press - (on) (LED ON) - press (off) (LED OFF)

JackZ
Posts: 2010
Joined: Mon Feb 22, 2016 1:02 pm

Re: Momentary push button - can i latch?

#2 Post by JackZ » Thu Aug 05, 2021 5:24 pm

Hi

This a matter of coding.
I suggest you create a Boolean Variable like led_on, that can have a value of either false or true.
You first initialize the button state to the startup value, say true.
Then each time you press the button, you alternate the current value by using this trick:

Code: Select all

led_on=not(led_on)
If led_on is true not(led_on) will switch to false.
If led_on is false not(led_on) will switch to true.

Then you act on the led state according to the value of led_on

Jacques
My YouTube Chanel on the A320 (Real SOPs by an Airline Pilot IRL):
https://www.youtube.com/playlist?list=P ... 0Q6SBASRqJ

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

Re: Momentary push button - can i latch?

#3 Post by jph » Fri Aug 06, 2021 7:58 am

@jonesy1991 Just a quick question - can you link to the switches you are planning to use please ?
“Everything in moderation, including moderation.”
“Experience is merely the name men gave to their mistakes.”
Joe (CISSP) -IT security consultant

jonesy1991
Posts: 3
Joined: Thu Aug 05, 2021 1:32 pm

Re: Momentary push button - can i latch?

#4 Post by jonesy1991 » Fri Aug 06, 2021 12:11 pm

jph wrote:
Fri Aug 06, 2021 7:58 am
@jonesy1991 Just a quick question - can you link to the switches you are planning to use please ?
hello, yes sorry i didn't think of that. i currently have 20 of these for the switch panel

https://www.ebay.co.uk/itm/284266138610

jonesy1991
Posts: 3
Joined: Thu Aug 05, 2021 1:32 pm

Re: Momentary push button - can i latch?

#5 Post by jonesy1991 » Tue Aug 10, 2021 12:24 am

JackZ wrote:
Thu Aug 05, 2021 5:24 pm
Hi

This a matter of coding.
I suggest you create a Boolean Variable like led_on, that can have a value of either false or true.
You first initialize the button state to the startup value, say true.
Then each time you press the button, you alternate the current value by using this trick:

Code: Select all

led_on=not(led_on)
If led_on is true not(led_on) will switch to false.
If led_on is false not(led_on) will switch to true.

Then you act on the led state according to the value of led_on

Jacques

Thank you for this information... I suspected it was possible. I will read up on Boolean variables

Thank you

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

Re: Momentary push button - can i latch?

#6 Post by jph » Tue Aug 10, 2021 7:42 am

jonesy1991 wrote:
Fri Aug 06, 2021 12:11 pm
jph wrote:
Fri Aug 06, 2021 7:58 am
@jonesy1991 Just a quick question - can you link to the switches you are planning to use please ?
hello, yes sorry i didn't think of that. i currently have 20 of these for the switch panel

https://www.ebay.co.uk/itm/284266138610
Hi @jonesy1991
Thanks for the link.
Here are some other really nice momentary switch units that may interest you for flight sim use. Very realistic and great price, and, very well made.
https://siminnovations.com/forums/viewt ... 331#p34158
There are more details, including changing the LED colour later in the thread.
I will add your switches to the thread also.
Joe.
“Everything in moderation, including moderation.”
“Experience is merely the name men gave to their mistakes.”
Joe (CISSP) -IT security consultant

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests