Annunciator panel cessna 172 A2A

Support for Arduino in combination with Air Manager and Air Player

Moderators: russ, Ralph

Post Reply
Message
Author
cristian
Posts: 32
Joined: Wed Nov 14, 2018 7:53 pm

Annunciator panel cessna 172 A2A

#1 Post by cristian »

Hello everyone, sorry to bother you, I am setting up the ad panel for the A2A cessna 172, the code was dealing with the LVARS of a2a but I don't know what I am failing at if you can correct me, please, It would be helpful as these are my first attempts . program the led lights :)

Code: Select all

-- Create two LED's, and have them off by default
led_fuel_l = hw_led_add("fuel left warning", 0.0)
led_fuel = hw_led_add("fuel warning", 0.0)

   function new_data_fsx(fuel_left_warning)

  bus_power = bus_volts >= 10

 if bus_power and fuel_left_warning[1] < 4 then
   hw_led_set(led_fuel_l, 1)
 else
   hw_led_set(led_fuel_l, 0)
end

function new_data_fsx(fuel_warning)
if bus_power and fuel_warning[1] < 4 then
   hw_led_set(led_fuel, 1)
 else
   hw_led_set(led_fuel, 0)
end

fsx_variable_subscribe("L:FuelLLight,bool", "gal", new_data_fsx)
fsx_variable_subscribe("L:FuelLight,bool", "gal", new_data_fsx)

User avatar
Ralph
Posts: 7924
Joined: Tue Oct 27, 2015 7:02 pm
Location: De Steeg
Contact:

Re: Annunciator panel cessna 172 A2A

#2 Post by Ralph »

Why are you having two of the same functions with one subscription looking to be incorrect? You're using bus_power, but there is no subscription to bus_power, and fuel_warning is not an array so you should not use [1].
Also, since you're not dimming the LED, have a look at the first yellow highlighted message: http://siminnovations.com/wiki/index.ph ... Hw_led_add

Post Reply