byteman59 Posted August 12, 2022 Posted August 12, 2022 Hmm, i am currently using Active Low. Can i use your code to switch?
No1sonuk Posted August 12, 2022 Posted August 12, 2022 Then use the active high version - it's what the LED code was designed for.
byteman59 Posted August 14, 2022 Posted August 14, 2022 On 8/12/2022 at 1:09 PM, No1sonuk said: Then use the active high version - it's what the LED code was designed for. Ouch! That is going to be a pain. will need to switch wires and re-solder. will give it a try.
No1sonuk Posted August 14, 2022 Posted August 14, 2022 You can use the code if it's too much hassle to rewire. I've done it for driving Neopixel addressable LEDs. Try this in the code function: if (newValue == 1){digitalWrite(LEDPIN, LOW);} else{digitalWrite(LEDPIN,HIGH);} That should do it. 1
byteman59 Posted August 15, 2022 Posted August 15, 2022 (edited) On 8/14/2022 at 5:39 AM, No1sonuk said: You can use the code if it's too much hassle to rewire. I've done it for driving Neopixel addressable LEDs. Try this in the code function: if (newValue == 1){digitalWrite(LEDPIN, LOW);} else{digitalWrite(LEDPIN,HIGH);} That should do it. Great, it would be a real pain, I'm also using 3.3v instead of 5v. Didn't know if this would cause a problem as well. Regardless, would this code be correct for the Left Elevator Idicator LED? would it go in the main, setup or loop section? Example: Left Elevator EMER DISENG Indicator (yellow) void onLElevatorEmerDisengageChange(unsigned int newValue) { if (newValue == 1){digitalWrite(LEDPIN, LOW);} else{digitalWrite(LEDPIN,HIGH);} } DcsBios::IntegerBuffer lElevatorEmerDisengageBuffer(0x10da, 0x0100, 8, onLElevatorEmerDisengageChange); Edited August 15, 2022 by byteman59
No1sonuk Posted August 15, 2022 Posted August 15, 2022 The power voltage doesn't affect the code unless you're measuring voltages. That code goes where all the DCS-BIOS lines go - usually above the setup, outside the setup or loop. They're functions in their own right. I don't have access to the control reference right now, so I don't know if the numbers are right.
byteman59 Posted August 15, 2022 Posted August 15, 2022 got it, i will give it a try later on and report the result.
byteman59 Posted August 15, 2022 Posted August 15, 2022 btw No1sonuk, how does one know all the commands in DCS-Bios? Is all the code possible available in hte DCS-Bios Reference Chart? I want to learn as much as i can about the programming of DCS-Bios. Thanks
No1sonuk Posted August 15, 2022 Posted August 15, 2022 2 hours ago, byteman59 said: btw No1sonuk, how does one know all the commands in DCS-Bios? Is all the code possible available in hte DCS-Bios Reference Chart? I want to learn as much as i can about the programming of DCS-Bios. In the DCS-BIOS Arduino library examples, there's a "one of everything" sketch. If you want to learn how those commands work, you can look in the Arduino library source code. BE CAREFUL not to accidentally edit them, though, in case you screw something up. On my computer, those files are located here: C:\Users\timja\Documents\Arduino\libraries\dcs-bios-arduino-library-0.3.7\src\internal Looking at the LED code in there, it possibly wouldn't take much effort to add an active low type, or a flag that can be set if required. The 2 position switch has that.
byteman59 Posted August 15, 2022 Posted August 15, 2022 (edited) On 8/14/2022 at 5:39 AM, No1sonuk said: You can use the code if it's too much hassle to rewire. I've done it for driving Neopixel addressable LEDs. Try this in the code function: if (newValue == 1){digitalWrite(LEDPIN, LOW);} else{digitalWrite(LEDPIN,HIGH);} That should do it. It worked great, thank you! pinMode(PIM, OUTPUT) needs to be set as well, in setup Edited August 15, 2022 by byteman59 1
No1sonuk Posted August 15, 2022 Posted August 15, 2022 FYI. I submitted code to the Flightpanels guys that would replace the LED function with one where you can add ",false" on the end to invert it. No idea when it'll make it to the full "build", though. 1
Recommended Posts