Thank you for responding.
I was able to find the examples with the "Your code here" but I don't really understand what I can put in there. Is it the code equivalent of the LED coming on? Meaning that whatever code you put in there will run when the state changes? I noticed the name makes it sound like it would run when it changes meaning turn on or off. Is there a way to distinguish which direction or more generally what kind of change?
Let me explain a little more about what I am trying to do with the Viggen and that may help.
AFK mode is basically an auto throttle for landing, it will physically move the throttle to stay at a proper airspeed for the landing mode selected elsewhere.
The typical flow is:
Turning AFK Mode ON
Mouse Click or use mapped button to lower AFK lever
The lever moves down in the cockpit, makes a clicking sound
When it is all he way down (about a second) a cockpit light illuminates indicating it is enabled
The autopilot takes control of moving the throttle to maintain landing speed.
Turning AFK Mode OFF
Mouse Click or use mapped button to raise AFK lever
The lever moves UP in the cockpit, makes a clicking sound
Cockpit light goes out as soon as the lever starts going up
The autopilot stops moving the throttle
From the code in the OP:
DcsBios::Switch2Pos afkLever("AFK_LEVER", 4);
The code above is for pin 4 which would be connected to a contact switch that would close when the physical AFK lever is lowered to turn that mode on when desired.
When that mode is on a the cockpit light turns on which is picked up by this code which then turns on an LED connected to pin 5 per this code:
DcsBios::LED afkLight(0x460e, 0x0400, 5);
Independent of all that, this code operates a servo that moves in relation to actual throttle position with the servo being operated by pin 3
DcsBios::ServoOutput throttle(0x4628,3, 544, 2400);
I am hoping to use the servo to move the physical throttle but the default behavior is for the servo to always move along with the throttle. I am trying to find some way to disable the servo in normal flight operations so I need to make the servo movement conditional on the AFK mode being on which would be when the pin 4 switch is closed or the LED from pin 5 is is on. (Both of those should always be true at the same time)
So if I could use those statements about something like this:
if(DcsBios::LED afkLight(0x460e, 0x0400, 5) == on)
{ DcsBios::ServoOutput throttle(0x4628,3, 544, 2400);}
or in simpler terms:
if (AFK Light is on) then operate servo
That clearly doesn't work but I am assuming there is something correct to fill that in and get the desired result.
Thanks again