Jump to content

[DCS-BIOS v0.5.3] A-10C Lighting Control Panel Sample Code

GSS Rain

Recommended Posts

Good Day, I used this sample code to drive the A-10C Lighting Control Panel. The version of DCS-BIOS at the time was v0.5.3.


The only thing of note is the Ant-collision switch coil which is connected to pin 8 of the arduino which is setup as a Digital Output to drive the coil circuit.




* DCS BIOS version 0.5.3




#include "DcsBios.h"


int Anticollision_Coil = 8;


// Position Lights FLASH/OFF/STEADY

DcsBios::Switch3Pos lcpPosition("LCP_POSITION", 2, 3);


// Formation Lights

DcsBios::Potentiometer lcpFormation("LCP_FORMATION", A7);


// Anticollision Lights (Magnetically Held Toggle Switch)

DcsBios::Switch2Pos lcpAnticollision("LCP_ANTICOLLISION", 4);


// Anticollision Lights Coil

void onLcpAnticollisionChange(unsigned int newCoilValue) {

switch (newCoilValue){

case 0:

digitalWrite(Anticollision_Coil, LOW);


case 1:

digitalWrite(Anticollision_Coil, HIGH);




DcsBios::IntegerBuffer lcpAnticollisionBuffer(0x1144, 0x0080, 7, onLcpAnticollisionChange);


// Engine Instrument Lights

DcsBios::Potentiometer lcpEngInst("LCP_ENG_INST", A6);


// Nose Illumination

DcsBios::Switch2Pos lcpNoseIllum("LCP_NOSE_ILLUM", 5);


// Aux Instrument Lights

DcsBios::Potentiometer lcpAuxInst("LCP_AUX_INST", A5);


// Signal Lights

DcsBios::Switch2Pos lcpSignalLights("LCP_SIGNAL_LIGHTS", 6);


// Flight Instrument Lights

DcsBios::Potentiometer lcpFlightInst("LCP_FLIGHT_INST", A4);


// Accelerometer and Compass Lights

DcsBios::Switch2Pos lcpAccelComp("LCP_ACCEL_COMP", 7);


// Flood Lights

DcsBios::Potentiometer lcpFlood("LCP_FLOOD", A3);


// Console Lights

DcsBios::Potentiometer lcpConsole("LCP_CONSOLE", A2);


void setup() {


pinMode (Anticollision_Coil, OUTPUT);



void loop() {



  • Like 1
Link to comment
Share on other sites

Very nice video Sir :thumbup: I like that you have solved the mag switches by coding yourself.

I am not at that level yet, but found that DCS-BIOS can include mag switches out of the box if it's just set in Advanced view.


To implement the mag switch that way all you need is this;


const byte lcpAnticollisionPins[2] = {PIN_0, PIN_1};
DcsBios::SwitchMultiPos lcpAnticollision("LCP_ANTICOLLISION", lcpAnticollisionPins, 2);
DcsBios::LED lcp_Anticollision(0x1144, 0x0080, PIN); 


You of cause needs two pins to get both positions of the mag switch.


Keep those videos comming :thumbup:




  • Like 1
Link to comment
Share on other sites

I'll take a look at that. I did have an anomaly where If the coil was commanded off do to say the pinky switch on the HOTAS, I could toggle the switch anti-collision switch up and down on the panel. The switch would not engage, which is normal, but the graphic in the game always showed the switch off (not moving). The graphic in the game should have showed the switch moving up and down as I was physically moving the switch. Even though it would not grab to the "ON" position, you still should see it moving. I think the way you have it illustrated will fix that. I saw the LED line but wasn't sure if that was tied to the switch location or coil state.


Thanks Hans.

Link to comment
Share on other sites

It is tied to the switch position. There is no way to get the coil state through Export.lua.


If you move an electrically held switch to the ON position, DCS-BIOS will hold the mouse button down on that switch (so it gets pushed to the ON position) and then immediately release the mouse button (so it stays if the coil is on and flips back if the coil is off). This happens in a single frame so you don't see any movement at all if it snaps back.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...