I am building an AP panel and have some momentary press switches with leds in them
I am trying to have the led come on, and an action take place when the switch is pressed and go off and the action stop when the switch is pressed again. eg the AP main switch.
Can anyone direct me to the code or what I need to do to get this to work.
I vagally remember reading about this some time ago but have been searching for the last hour and cannot find any thing
#Momentary switch with LED
1 messages · Page 1 of 1 (latest)
Have you got a separate feed for the LED?
The LED needs to be setup as an output LED and reference a specific event, ie HDG Toggle
Normally you want the button to send a command to the Sim (input), but the led should show the status of the sim (output).
There are many tutorials and examples in the Github wiki
Yes thank you I got that. I already have some led working. What i am trying to do is use a momentary switch to say turn on the HDG on the AP panel and have the light come on when I press the switch. When pressed again the led goes out and the HDG is disengaged. I hope this makes it a bit clearer.
I think it is something to do with creating a precondition may be??
@wraith basin
You missunderstand.... The LED is not set to ON or OFF by the button ... Also not in a real aircraft.
The LED must show the status of the virtual System !
Simple example.... If you enable the HDG Mode with the Mouse in the Virtual Cockpit then the LED must be ON (Cause the virtual one is also on).... But you never make a input here with the button itself....
So the LED Control should NEVER be related to the button itself !
Thats what @clear edge try to say.....
There exist 2 types of Buttons with included LED..... We need the sort where the LED is fully independent .
The other Sort ( Mostly Car HiFi Stuff) is combined. Means e.g. the LED is only powerd if the Button is in ON Position or so.
Those are not useable in Home cockpits.
Simple Rule: See the LED and the Button always as 2 Things. And controll them always with 2 single Configs.
Hi Pizman. Thanks for trying to help, and I understand your explanation. Maybe I didn't explain my self clearly. I am trying to build a Auto pilot panel similar to the one in this YouTube one. https://www.youtube.com/watch?v=a706b1QiUp8. He has used momentary switch's in this as is listed in his parts list. How does the momentary switch stay on?? Thanks
More info: https://jeffrlatham.wixsite.com/vizix/autopilot
Thingiverse: https://www.thingiverse.com/thing:5258730
Mobiflight software: https://www.mobiflight.com
Heli Mech YouTube Channel: https://www.youtube.com/channel/UCk3QdcLf2UPk0GCNj2JhmqA
I made real, physical autopilot hardware and controls for Flight Simulator, and you can too! This wo...
think of the LED as a separate thing from the button
make led output that uses the simvar of autopilot "heading hold mode" for your airplane. On default planes it is Microsoft -> Generic -> Autopilot -> AUTOPILOT HEADING LOCK.
This has nothing to do with your input button. That is a separate thing, but your LED should show the state of the autopilot heading lock in the simulator, if you enable HDG mode with the mouse on the cockpit.
Once that works, you can set the button INPUT to Microsoft -> Generic -> Autopilot -> AP_PANEL_HEADING_HOLD
and check that it sets the autopilot HDG mode on the simulator panel.
Once both work on their own, you have what you want.
Basically the ground rule is always that inputs control the simulator systems, and leds reflect the state of the simulator system.
In some cases you might need to do some logic "locally" without the sim, like if you have a button that is not simulated in the plane, but you wish to have its led toggle on/off as part of your cockpit workflow, but in general this is not the way to do it.
@wraith basin How does the momentary switch stay on??
You awnser your question already yourself. It can´t stay ON cause its "Momentary"
A Momentary switch just send a single signal when you use it. It have no latching On Position. Its always OFF if you not touch it.
So.... Like in Video (and like Tuomas said)
If the guy press a Button then MF send a command to Sim ( in easy way it say "Press the virtual Button for me" )
The LED in the Button is not effected by this.... This LED only show the current state of the Virtual LED.
Thats also the reason for the Delay you see in the Vid.
When you Press the Button then the virtual Button get Pressed.... Then the Virtual LED goes on and finally your LED goes On.
Also in Real those Buttons have no ON Position.... Cause the HDG LED for example can get OFF by itself (when you Disconnect AP/FD for example.
So its not logical if this Button would latch.... Cause then it would be ON whatever System is OFF.