#3955204 - 05/18/14 08:31 PM
LEDs on when Throttle Greater than 80%
|
Joined: Nov 2004
Posts: 47
LoneStar
Junior Member
|
Junior Member
Joined: Nov 2004
Posts: 47
San Antonio, Texas
|
Trying to get LEDs (LED0) to turn on when my throttle is at 80%. I using the script code below...
ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 0)); //set Throttle backlight power to 0
KeyAxis(&Throttle, THR_LEFT, 0, AXMAP1(LIST(0, 80, 100),
(PULSE+LED(&Throttle, LED_INTENSITY, 0)),
(PULSE+LED(&Throttle, LED_INTENSITY, 255)))); When I start the script, the LEDs start in the ON state (255 intensity). If I move the throttle to 100% and back to 0% the LEDs turn off and then will work as programed, i.e. ON when throttle is pushed forward above 80% and OFF when throttle is pulled back below 80%. I have switched the 0 and 255 values with the same result. I thought the first line of the above code was supposed to initialize the LED power to level zero but it's not happening. Can someone advise me on what I'm doing wrong? Thanks for any help!
|
|
#3955218 - 05/18/14 09:10 PM
Re: LEDs on when Throttle Greater than 80%
[Re: LoneStar]
|
Joined: Nov 2004
Posts: 47
LoneStar
Junior Member
|
Junior Member
Joined: Nov 2004
Posts: 47
San Antonio, Texas
|
Sorry, I forgot to switch the INTENSITY codes back after testing. Here's the code that needs help... ActKey(PULSE+KEYON+LED(&Throttle, LED_INTENSITY, 0)); //set Throttle backlight power to 0
KeyAxis(&Throttle, THR_LEFT, 0, AXMAP1(LIST(0, 80, 100),
(PULSE+LED(&Throttle, LED_INTENSITY, 255)),
(PULSE+LED(&Throttle, LED_INTENSITY, 0)))); When the script starts, the LEDs turn on (should be off). If I push the throttle to 100% and then back to 0% the LEDs turn off. Then the LEDs will turn on when I push the throttle forward through 80% and will turn off when I pull the throttle back through 80%. Thanks,
|
|
#3958617 - 05/27/14 08:43 AM
Re: LEDs on when Throttle Greater than 80%
[Re: LoneStar]
|
Joined: Oct 2010
Posts: 83
Nicu
Junior Member
|
Junior Member
Joined: Oct 2010
Posts: 83
|
KeyAxis initialization generates some stray key presses, so a little delay is required to turn off the leds (I use DeferCall for this). Also, you may not use LED_INTENSITY, which is global for all LEDSs, but use LED_ONOFF, which turn on and off each led (LED0 is the background light). DeferCall(100, &ActKey, KEYON+LED(&Throttle, LED_ONOFF, 0)); // all LEDS off
KeyAxis(&Throttle, THR_LEFT, 0, AXMAP1(LIST(0, 80, 100),
(PULSE+LED(&Throttle, LED_ONOFF, LED0)), // only LED0 (background) ON
(PULSE+LED(&Throttle, LED_ONOFF, 0)))); // all LEDs off
|
|
|
|
|
|
Exodus
by RedOneAlpha. 04/18/24 05:46 PM
|
|
|
|
|
|
|
|