Kenpilot Posted May 7, 2022 Share Posted May 7, 2022 I have a rotary encoder connected to an arduino mega and using dcs bios for the HSI Heading bug selector for the A10C. The knob works but it will change directions while turning the knob. When I turn it clockwise it'll start to rotate clockwise and then it'll change direction randomly to counter-clockwise and then switch back, etc. I'm using this language from dcs bios in my sketch: DcsBios::RotaryEncoder hsiHdgKnob("HSI_HDG_KNOB", "-3200", "+3200", PIN_A, PIN_B); I have the pins connected to digital input pins on the arduino. I have the same exact setup for the course knob and it works perfectly fine. Any ides or suggestions as to why it's doing this and how to fix it? 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 May 7, 2022 Share Posted May 7, 2022 Are both encoders the same type? What type are they? Have you tried switching the encoders to see if it's the encoder itself? The problem might be a result of switching noise. When I use rotary encoders (the bare components), I add a couple of 100nF capacitors to kill noise. They are connected from each of pins A and B to GND. Link to comment Share on other sites More sharing options...
Kenpilot Posted May 8, 2022 Author Share Posted May 8, 2022 It turned out to be a bad encoder, which is strange since they're new. I swapped it out and everything worked fine. Thanks for the help!! 1 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...
Recommended Posts