Hi. I'm trying to make a flood light for F-16. But I found that original code for instrument panel flood light only emits 0 for off and 1 for on. So I made some inquiry to Warlord and he gave me some edit for F-16.lua files (https://github.com/DCSFlightpanels/dcs-bios/issues/113#ref-commit-3ea3d55).
So after editing F-16.lua file,I started looking for some extra information. My initial code for my flood light is
#define DCSBIOS_IRQ_SERIAL
#define flood_light 3
#include "DcsBios.h"
void onLightConslesFloodChange(unsigned int newValue) {
int val255 = map(newValue, 0, 65535, 0, 255); /* translate newValue(Trying to change 16 bit to 8 bit for PWM) into new integer variable called "val255" */
// int val255 = newValue * 255;
analogWrite(flood_light, val255); //Light the LEDs.
}
DcsBios::IntegerBuffer lightConslesFloodBuffer(0x4480, 0x8000, 15, onLightConslesFloodChange);
void setup() {
pinMode(flood_light, OUTPUT); //Pin 3 Output
DcsBios::setup();
}
void loop() {
DcsBios::loop();
}
But it seems not working. Any insights will be thankful.