Zorg. Posted September 13, 2023 Posted September 13, 2023 Hi It's possible to use this multiplexer for inputs with dcs bios. https://www.ti.com/product/CD74HC4067 I need to inscrease number of pins from arduino nano. Thk
Vinc_Vega Posted September 13, 2023 Posted September 13, 2023 Try the MCP23017, it's I2C compatible and there is already an Adafruit library available for it. Regards, Vinc Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Zorg. Posted September 13, 2023 Author Posted September 13, 2023 (edited) Thk but this module seems more expansive than nano. Edited September 13, 2023 by Zorg.
lesthegrngo Posted September 13, 2023 Posted September 13, 2023 I’m interested to try this myself- I have some sketches that are not limited by pins but by the number of DCS Bios components connected to it. For example, a mega with all 6 IFF BCD switches connected can only accept 4 more switches before the sketch fails to work, despite using less than a quarter of the available pins cheers
Vinc_Vega Posted September 13, 2023 Posted September 13, 2023 (edited) Edit: for the application of the above CD47HC4067 chip see here: http://adam-meyer.com/arduino/CD74HC4067 It could be used as a 16 pin analogue channel expander to your Nano board. The MCP digital expanders are also available for the SPI interface, just google for MCP23S17. I use the cheaper waveshare MCP23017 board for the I2C bus and may give you some hints to deal with it. https://www.waveshare.com/mcp23017-io-expansion-board.htm It's a 16 digital pins extension and works good for me with the Nano. The expanders may be daisy chained if the I2C addresses are manipulated. Here is a link to Adafruits' library that even works with the waveshare chipsets, for your imagination. https://learn.adafruit.com/adafruit-mcp23017-i2c-gpio-expander/arduino Other than to the Nanos' DcsBios code you have to take care to regularly pull the input status from the expanded ports. But this easily can be scripted. Regards, Vinc Edited September 14, 2023 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Vinc_Vega Posted September 14, 2023 Posted September 14, 2023 For your information I just wrote a small tutorial on how to deal with the MCP23017 port expander: Regards, Vinc Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
Zorg. Posted September 15, 2023 Author Posted September 15, 2023 (edited) Hi Vinc. Thank again for reply, i'm looking at it closely. I will try to see if it is good for my project. Edited September 15, 2023 by Zorg. 1
98abaile Posted September 15, 2023 Posted September 15, 2023 (edited) I got the solution from discord. The problem was that I hadn't set my muxSIG pin's internal pullups. Changing the pinmode from INPUT to INPUT_PULLUP fixed the issue. ------------------------- I'm wondering if anyone can help me with my attempt at using a multiplexers? Here's the code I have so far: #include <Arduino.h> const int muxSIG1 = 2; const int muxSIG2 = 3; const int muxS0 = 15; const int muxS1 = 14; const int muxS2 = 16; const int muxS3 = 10; int SetMuxChannel(byte channel) { digitalWrite(muxS0, bitRead(channel, 0)); digitalWrite(muxS1, bitRead(channel, 1)); digitalWrite(muxS2, bitRead(channel, 2)); digitalWrite(muxS3, bitRead(channel, 3)); } void setup() { //Joystick.begin(); pinMode(muxSIG1, INPUT); pinMode(muxSIG2, INPUT); pinMode(muxS0, OUTPUT); pinMode(muxS1, OUTPUT); pinMode(muxS2, OUTPUT); pinMode(muxS3, OUTPUT); Serial.begin(9600); delay(1000); } void loop() { for (byte i = 0; i < 15; i++) { SetMuxChannel(i); bool a = digitalRead(muxSIG1); bool b = digitalRead(muxSIG2); Serial.print("Push button at channel "); Serial.print(i); Serial.print(" is "); Serial.println(a == LOW ? "pressed" : "not pressed"); Serial.print("Push button at channel "); Serial.print(i+15); Serial.print(" is "); Serial.println(b == LOW ? "pressed" : "not pressed"); delay(1000); } Serial.println(); delay(1000); } Unfortunately all that happens is that all buttons show as constantly pressed. I know the wiring is fine since the same setup works just fine in Mobiflight and everything works as expected. Edited September 16, 2023 by 98abaile
Recommended Posts