Elevator Trim position indicator using LEDS?
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Elevator Trim position indicator using LEDS?
@SimPassion
Wow, thanks for all of that.
It works in AM allowing me to make the connections to the arduino pins.
But I don't know how to add the rotary encoder to scroll through the lights as I rotate the trim wheel.
I like the idea of the bar graph, but for me I would need a shorter version if I can get a straight section of lights to work.
There may be a way to add individual small LEDs (maybe miniature SMD types?) on a curved board somehow, but that will take some engineering on my part.
Wow, thanks for all of that.
It works in AM allowing me to make the connections to the arduino pins.
But I don't know how to add the rotary encoder to scroll through the lights as I rotate the trim wheel.
I like the idea of the bar graph, but for me I would need a shorter version if I can get a straight section of lights to work.
There may be a way to add individual small LEDs (maybe miniature SMD types?) on a curved board somehow, but that will take some engineering on my part.
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Elevator Trim position indicator using LEDS?
Perhaps a stepper or servo with a needle that sticks through the slot might be another solution.
Though I have never worked with those motors before.
Though I have never worked with those motors before.
Re: Elevator Trim position indicator using LEDS?
Nooo! Do not start messing in the script, just set the number of LED's you want to use.
The trim wheel and indicator do not need to know about each other, there's no link between these two.
The trim wheel and indicator do not need to know about each other, there's no link between these two.
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Elevator Trim position indicator using LEDS?
So it works with the Piper Arrow III, quick and dirty (script updated for fixes) :
On first run with trim in neutral position
In-sim DN position
related leds showing
could be in the reverse way on leds
On first run with trim in neutral position
In-sim DN position
related leds showing
could be in the reverse way on leds
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Elevator Trim position indicator using LEDS?
Simple, with an encoder, just use "sim/flight_controls/pitch_trim_down" and "sim/flight_controls/pitch_trim_up" command depending on the way we rotate the encoderKaellis991 wrote: ↑Mon Apr 03, 2023 1:09 pm Perhaps a stepper or servo with a needle that sticks through the slot might be another solution.
Though I have never worked with those motors before.
Code: Select all
function pr_trim_change(dir)
if dir == -1 then
xpl_command("sim/flight_controls/pitch_trim_up")
elseif dir == 1 then
xpl_command("sim/flight_controls/pitch_trim_down")
end
end
hw_dial_add("TRIM Encoder",pr_trim_change)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Elevator Trim position indicator using LEDS?
Just added hw_add_button to set trim straight forward for takeoff :
Code: Select all
--====================================================================================
-- CHECK PURPOSE
--====================================================================================
led_id_0 = hw_led_add("LED 0", 0)
led_id_1 = hw_led_add("LED 1", 0)
led_id_2 = hw_led_add("LED 2", 0)
led_id_3 = hw_led_add("LED 3", 0)
led_id_4 = hw_led_add("LED 4", 1)
led_id_5 = hw_led_add("LED 5", 0)
led_id_6 = hw_led_add("LED 6", 0)
led_id_7 = hw_led_add("LED 7", 0)
led_id_8 = hw_led_add("LED 8", 0)
led_nbr = 9
function compute_SI_Trim(trim_in)
trim = var_cap(math.floor((led_nbr-(trim_in * 4.5)) - 4.5),0,8)
-- trim = led_nbr - trim - 1 -- if it's required to invert the way leds are displayed, just un-comment this line
-- print(trim)
hw_led_set(led_id_0, trim==0)
hw_led_set(led_id_1, trim==1)
hw_led_set(led_id_2, trim==2)
hw_led_set(led_id_3, trim==3)
hw_led_set(led_id_4, trim==4)
hw_led_set(led_id_5, trim==5)
hw_led_set(led_id_6, trim==6)
hw_led_set(led_id_7, trim==7)
hw_led_set(led_id_8, trim==8)
end
xpl_dataref_subscribe("sim/cockpit2/controls/elevator_trim","FLOAT",compute_SI_Trim)
function pr_trim_change(dir)
if dir == -1 then
xpl_command("sim/flight_controls/pitch_trim_up")
elseif dir == 1 then
xpl_command("sim/flight_controls/pitch_trim_down")
end
end
hw_dial_add("TRIM Encoder",pr_trim_change)
function pr_trim_takeoff()
xpl_command("sim/flight_controls/pitch_trim_takeoff")
end
hw_button_add("TRIM Takeoff set", pr_trim_takeoff)
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Elevator Trim position indicator using LEDS?
Not missing Ralph's mentioned Trim LEDs Indicator :
Just add the encoder handling in an own custom instrument logic.lua script
Just add the encoder handling in an own custom instrument logic.lua script
-
- Posts: 581
- Joined: Mon Sep 07, 2020 8:49 am
Re: Elevator Trim position indicator using LEDS?
So much to unpack there.
You guys make it look so easy....
Thanks for the code and the information.
I will set it all up this coming weekend.
You guys make it look so easy....
Thanks for the code and the information.
I will set it all up this coming weekend.
Re: Elevator Trim position indicator using LEDS?
Don't mind the number of LED's in the Create/Edit tab, which is always 10, that's a bug in Air Manager. This bug is fixed in 4.2. It works good in the Home tab.
-
- Posts: 5346
- Joined: Thu Jul 27, 2017 12:22 am
Re: Elevator Trim position indicator using LEDS?
Thanks, I confirm I've seen this Ralph, though I've not taken it in account, however I'd let it on the side while taking a screenshot, to avoid to Kirk going to wonder