Kenpilot Posted March 24 Share Posted March 24 I'm building the Intercom Panel for the A10 and this is how I'm wanting to build it, but need some help. I'm using rotary encoders with switches for the volume knobs, and an Arduino Mega to be used with DCS Bios. I want to wire the knobs so that they are "turned on" only when I push the encoder switch, and turned off when I push it again. Along with this, I'd like to wire an LED backlight for the panel to light up when I push the switch, showing me that volume knob is "on" or "active", and then turned off when I push the switch again. So how do I wire the rotary encoder with switch (GND, +, SW, DT, CLK), the LED (+,-) and Arduino Mega. Thank you for any help! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir Link to comment Share on other sites More sharing options...
Vinc_Vega Posted March 24 Share Posted March 24 (edited) Hi Ken, You need 4 pins for each of the functions: 2 digital pins for the rotary, 1 digital pin for the switch and 1 pin for the corresponding LED. All can have a common pin to the GND signal. The (+) mostly is not necessary as the positive voltage is provided from the digital pins (internal pullup). Some rotaries do have (+) pin, that is to be connected to the Arduino 5V rail. For the DcsBios part you may work with the "action button" function and "state machines". Regards, Vinc Edited March 24 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Kenpilot Posted March 27 Author Share Posted March 27 Hey Vinc! Thanks for the response. Unforunately I'm not familiar with how to use the "action button" function and "state machines" in DCS Bios. The only thing I know how to do is copy and paste the sketch language from DCS Bios to the Arduino. I don't know what the coding means or how to write my own. Do you know of any tutorials or videos for beginners that would hep me understand them so I can figure this out? Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir Link to comment Share on other sites More sharing options...
Vinc_Vega Posted March 27 Share Posted March 27 (edited) Hi Ken, For the actionbutton function have a look into the below linked DcsBios documentation. Scroll down and find some examples. To make it short, an actionbutton is a pushbutton that can toggle between ON and OFF. That's what you need to enable or disable the respective rotary by its pushbutton. https://dcs-bios.readthedocs.io/en/latest/code-snippets.html A state machine is a piece of code that enables you to switch between several known states to do something. For your application a dedicated rotary should be responsive or not. That already are two states. So the rotary's pushbutton may be programmed to send either the ON or the OFF state of the respective rotary to DcsBios. You than read in either 1 or 0 into a variable and can use an if-else loop or case-switch to activate or de-activate the rotary. Edit: The solution is simpler after I had a detailed look into Bort, because we have the opportunity to use the Mute/Unmute function for the Intercom Panel switches. So the "state machine" is already provided to us by DcsBios. Example for the INT switch and rotary encoder: // ----- INT Un-Mute input and output, INT volume adjustment ----- DcsBios::ActionButton intIntUnmuteToggle("INT_INT_UNMUTE", "TOGGLE", 10); // INT switch on pin 10 for the INT Un-Mute switch DcsBios::RotaryEncoder intIntVol("INT_INT_VOL", "-3200", "+3200", 11, 12); // INT volume rotary is connected to pins 11 and 12 DcsBios::LED intIntUnmute(0x1194, 0x8000, 13); // a LED shows if the volume adjustment is active That's all for one of the Intercom Panel switches. Regards, Vinc Intercom_example_01.ino Edited March 27 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Kenpilot Posted March 27 Author Share Posted March 27 Thanks so much Vinc!!! I appreciate you taking the time to look that up and send me the sketch for it. I'm still going to check out the link you sent as well to try and educate myself on this stuff. I'm going to try this out in the next few days and hopefully get it working. Thanks again!! Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir Link to comment Share on other sites More sharing options...
Kenpilot Posted March 28 Author Share Posted March 28 (edited) It worked!! Thanks again Vinc!! Edited March 28 by Kenpilot Windows 10 ASRock Z370 Extreme4 LGA 1151 (300 Series) MOBO intel i7-8700k (Not overclocked) 16 GB Ram EVGA GeForce GTX 108ti SC Black Edition SSD Trackir Link to comment Share on other sites More sharing options...
No1sonuk Posted March 28 Share Posted March 28 Something you might come up against when using rotary encoders is the steps per detent being wrong. It might move 4 steps when you want one. See "Example 2" here for how to fix that: https://github.com/DCS-Skunkworks/dcs-bios-arduino-library/wiki/RotaryEncoder Link to comment Share on other sites More sharing options...
Recommended Posts