MobiFlight Community Support

Welcome to the forum for MobiFlight! Feel free to reach out to the community in case you have questions, issues or just want to share great ideas or details about your latest home cockpit project.

You like MobiFlight? Donate via PayPal and support the MobiFlight development. Thanks! 

05/03/2024 - This forum is read-only

The community support for MobiFlight has moved exclusively over to our Discord server. Register for free and enjoy more interactive functions like image and video upload, voice chat. More than 7,000 registered users around the world make it a great experience!

See you on our MobiFlight Community Discord server.

A HUGE Thank You to everyone who participated in the forum, especially obviously to Pizman and Stephan who did an outstanding job over so many years providing an incredible service to the MobiFlight community.

The forum is still providing a lot of good content, hence we keep this information accessible.

icon
Avatar
jjvelar
Posts: 47
Hi,
I'm trying to reproduce the CVR test button and led but there is no offset for the led.
Therefore I was thinking in this simple logic:

if CVR_Test_Button = ON
then
delay(5 secs)
CVR_Test_Led = ON
end_if

But I have no idea about how to implement this.
Thanks!
2017-04-15 08:09
Avatar
jjvelar
Posts: 47
iconjjvelar:

Hi,
I'm trying to reproduce the CVR test button and led but there is no offset for the led.
Therefore I was thinking in this simple logic:

if CVR_Test_Button = ON
then
delay(5 secs)
while CVR_Test_Button = ON
then
CVR_Test_Led = ON
end_while
end_if

But I have no idea about how to implement this.
Thanks!

2017-04-15 08:50
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Hi. Please tell us what Aircraft you use ( Addon ??)
Maby we find a offset for you.

If NOT

Mobiflight not supports a feature like this. BUT you can programm this with a lua code ( require a registred FSUIPC for maby 30$)

Maby there is a improve way to do this....
Please tell me exactly what should be happen and hwo this workes.
Should the LED Light aslong you push the Button... Or Only after pushing the button for 5 Seconds .... When should it get off again ??
Good Luck !
2017-04-15 14:54
Avatar
jjvelar
Posts: 47
Hi
Thanks for your reply.
I'm using PMDG 737NGX and Prepar3D.
I'm trying to reproduce the behaviour of the overhead cockpit voice recorder test button and led.
It works this way: you press the button and keep it pressed for 3-5 seconds until the green led switches on. Then, you release the button and the green light switches off.
I tried to explain it with this pseudo-code:

if CVR_Test_Button = ON
then
delay(5 secs)
while CVR_Test_Button = ON
then
CVR_Test_Led = ON
end_while
end_if

Thanks,

Jose
2017-04-15 19:10
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
OK.

This LED is not simulated i think..... ( Crazy cause the FlightRecorder LED is still on a offset)

But ok.... It´s easyer cause this System is not simulated at all.... That means our switch and LED not need to connect via FSUIPC to the simulator.
( It´s not needed to push the simulated button cause it make no sence in the PMDG)

Solution.... You need a self writte program (nearly like youres) that do this. You can write this with Arduino Code itself. The Board then is NOT a Mobiflight Board (And need no USB Cenection if you power it youreself)
In easy words... You write a own program that says... If you push the Button then Variable X = 0 ... Aslong the Button is Pushed Every 1 Second X+1 .... If X is 5 or Bigger then Light LED on Pin ? ..... When Button is released X=0 .

Alternate you can work with Lua, a free Offset and Mobiflight..... Here you can use a Joystick Contrroller or Mobiflight Input.
Here you need a difficult self written code too..... Only benefit here is that you not need a additional Arduino... You can use youre Mobiflight Board for this.

Finaly i would recomend to simply "cheat" a little bit..... Use the LED direct.... I Know it lights if you push the button..... But is a not simulated part so important to do all the work for it ? .... Result... The Button work... The LED Light Only the 5 Seconds are not simulated!
Good Luck !
2017-04-16 00:51
Avatar
jjvelar
Posts: 47
you say: "you can work with Lua, a free Offset and Mobiflight"

could you suggest how to start with lua and mogiflight?

thanks!
2017-04-17 10:59
Avatar
pizman82
Moderator
From: ETSI, Germany
Posts: 6010
Supporter
Sorry... My Experience in Lua Code is still low.....
I Can´t give you a working code example at the moment....
BUT. The Technic is self explaned.....

You define a Input ( Joystickbutton.... OR virtual Joystick Button controlled by Mobiflight---- OR A Offset that is written by Mobiflight with youre switch)
You define a Custom Offset as a Output..... ( this Offset will be read by Youre LED via Mobiflight.... 1= ON 0 = OFF )
Then you need a code like you describe.... Aslong the button is pushed start a counter with Zero 0 and count every second +1 until the Counter = 5 .... Then wirte the Output Offset from 0 to 1 ( LED ON cause Mobiflight read this offset) .... If Butte will be released the offset swap back to 0 and the Counter, too.

Maby there are some advanced LUA Users here that can give you a code example
Good Luck !
2017-04-17 23:18
Avatar
jjvelar
Posts: 47
Thanks pizman82
2017-04-22 08:23
icon