---On the real aircraft
The Battery Warning light comes on when the Battery is no longer charging (failed charging system or the generator is not on).
If the charging system kicks back on the Battery Warning light will only turn off if the Battery Switch is reset.
--In my code
The Battery Warning light turns on when the charging system fails or the generator is off which is correct.
My problem is that the light goes out as soon as the charging system is restored.
How can I make a condition where the Battery Warning LED can only turn off if the Battery Switch is cycled once the charging system is restored?
See below for my current code. Thanks in advance!
Code: Select all
led_is_charging = hw_led_add("Arduino_MEGA_2560_A_D13",0) function num(bool) if bool then return 1 else return 0 end end function is_charging(charging) hw_led_set(led_is_charging, 1-num(charging)) end fsx_variable_subscribe("ELECTRICAL BATTERY IS CHARGING", "Bool", is_charging)