GSS Rain Posted May 31, 2017 Share Posted May 31, 2017 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 */ #define DCSBIOS_IRQ_SERIAL #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); break; case 1: digitalWrite(Anticollision_Coil, HIGH); break; } } 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() { DcsBios::setup(); pinMode (Anticollision_Coil, OUTPUT); } void loop() { DcsBios::loop(); } 1 Link to comment Share on other sites More sharing options...
Hansolo Posted June 1, 2017 Share Posted June 1, 2017 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: Cheers Hans 1 132nd Virtual Wing homepage & 132nd Virtual Wing YouTube channel My DCS-BIOS sketches & Cockpit Album Link to comment Share on other sites More sharing options...
GSS Rain Posted June 2, 2017 Author Share Posted June 2, 2017 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 More sharing options...
FSFIan Posted June 2, 2017 Share Posted June 2, 2017 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. DCS-BIOS | How to export CMSP, RWR, etc. through MonitorSetup.lua Link to comment Share on other sites More sharing options...
GSS Rain Posted June 2, 2017 Author Share Posted June 2, 2017 Thanks Ian. Link to comment Share on other sites More sharing options...
Recommended Posts