mikez69 Posted February 4 Posted February 4 I have been starting my panel designs but I wanted to figure out lighting before I get too far. Ultimately I am concerned about and have only found a few small instructions on where to start. TL:DR I want my F16 Internal Lighting panel to effect the real world LED's for each of my panels. I need to figure out if I am able to get that data and if I can how to send that out to each of the panels. I may be over simplifying the process as well. But while I am able to use BORT to get switches to work, this is a little more advanced for my limited knowledge on the subject.
Deadman Posted February 4 Posted February 4 Use a Double pole switches, They are connected to two separate electric circuits so one circuit goes to your IO board and the game and one goes to power the panels. 1 https://forum.dcs.world/topic/133818-deadmans-cockpit-base-plans/#comment-133824 CNCs and Laser engravers are great but they can't do squat with out a precise set of plans.
mikez69 Posted February 5 Author Posted February 5 5 hours ago, Deadman said: Use a Double pole switches, They are connected to two separate electric circuits so one circuit goes to your IO board and the game and one goes to power the panels. Interesting idea, I will start researching that, thanks! 1
Ulukaii Posted March 4 Posted March 4 (edited) Take inspiration from OpenHornet. To set the desired light value, the following route is used: Potentiometer --> Arduino --> DCS-Bios --> set INSTR Lt value in DCS. To read the light value from DCS, the following route is used: DCS --> DCS-Bios --> Arduino (a different one that controls the LEDs) --> LEDs. When I now turn the potentiometer, the desired LED brightness value is sent to DCS; and with no noticable delay, it is read from DCS and the real-life LEDs are set accordingly. Works flawlessly. Video attached. IMG_3404.mov Edited March 4 by Ulukaii
Ulukaii Posted March 4 Posted March 4 Here is an example code for the READ FROM DCS command, if you want to use DCS BIOS: //Check Arduino board in use #if defined(__AVR_ATmega328P__) || defined(__AVR_ATmega2560__) #define DCSBIOS_IRQ_SERIAL #else #define DCSBIOS_DEFAULT_SERIAL #endif #ifdef __AVR__ #include <avr/power.h> #endif //Include required external libraries #include "DcsBios.h" #include <Adafruit_NeoPixel.h> //Set up the backlight (BL) channels; original OpenHornet code has 10 different channels. const uint8_t UIP_BL_CH1 = 11; //Arduino control Pin const uint8_t UIP_BL_CH1_COUNT = 208; //number of individually adressable LEDs Adafruit_NeoPixel UIP_1 = Adafruit_NeoPixel(UIP_BL_CH1_COUNT, UIP_BL_CH1, NEO_GRB + NEO_KHZ800); //instantiate LED strip object //set up LED colours uint32_t IndYellow = LC_1.Color(255, 255, 0); //Yellow Indicators uint32_t IndRed = LC_1.Color(255, 0, 0); //Red Indicators uint32_t IndGreen = LC_1.Color(0, 255, 0); //Green Indicators uint32_t IndWhite = LC_1.Color(40, 40, 30); //White for Jett Station Select toggle light uint32_t dark = LC_1.Color(0, 0, 0); //No colour //Define a function that takes the INSTR LT value from DCS and sets the hardware LEDs accordingly void onInstrIntLtChange(unsigned int newValueInstrIntLt) { uint8_t brightness = map(newValueInstrIntLt, 0, 65535, 0, 255); //Instrument brightness according to value in DCS uint32_t PanelGreen = LC_1.Color(0, 100 * brightness / 255, 0); //Panel backlight colour //MASTER ARM panel backlight for (int i = 4; i < 25; i++) { UIP_1.setPixelColor(i, PanelGreen); } //HUD panel backlight for (int i = 59; i < 115; i++) { UIP_1.setPixelColor(i, PanelGreen); } //SPIN RECOVERY panel backlight for (int i = 145; i < 174; i++) { //SPIN RECOVERY panel backlight 1/3 UIP_1.setPixelColor(i, PanelGreen); } for (int i = 175; i < 181; i++) { //SPIN RECOVERY panel backlight 2/3 UIP_1.setPixelColor(i, PanelGreen); } for (int i = 182; i < 208; i++) { //SPIN RECOVERY panel backlight 3/3 UIP_1.setPixelColor(i, PanelGreen); } //... add more panels here .... UIP_1.show(); } //Most important line coming up: //This "integer buffer" command actually links the hardware-controlling function defined above to the specific event that the instrument light has changed in the DCS software. DcsBios::IntegerBuffer instrIntLtBuffer(0x7560, 0xffff, 0, onInstrIntLtChange); void setup() { //Run DCS Bios setup function DcsBios::setup(); // INITIALIZE NeoPixel strip object (REQUIRED) UIP_1.begin(); // Show the neopixel UIP_1.show(); } void loop() { //Run DCS Bios loop function DcsBios::loop(); } And the code to set the value in DCS by reading from a a potentiometer (or, in my case, a rotary encoder) could be as simple as DcsBios::RotaryEncoder instPnlDimmer("INST_PNL_DIMMER", "-3200", "+3200", PIN_A, PIN_B); (please refer to DCS BIOS library)
Recommended Posts