Hey everyone. First time poster…
I’m currently trying to make a usb device, and I’m quickly running out of available pins for differing input types. The device I’m making is a button box for my simulator setup.
The box itself has the following, 5 Momentary switches, one LED momentary on/off button, 4 rotary encoders with buttons, and not being used by the arduino(s) are 2 latching style on off switches/buttons (although i would like to ideally use them as well). My problem is I’m relatively new to the whole coding and even using arduinos, and I quickly found myself out of available pins when plotting it all out.
I’ve been bouncing around between using a pro micro, Leonardo, nano, or uno for this project, which I have all on hand. I currently have 2 uno’s and 2 micros. Seeing that I need this to be a usb input device that kinda kills the uno and nanos, however. So my question is this I guess..
If it’s possible, can I use say the Leonardo as a master, and with I2C add on inputs from the nano or an uno? I really just need the slave board to be able to send a button pressed/encoder turned CW/CCW signal to the Leonardo or Micro, which can then talk to my PC and say ‘yes, button (x) on this device was pressed’
In the future I’d like to add on more things to this device like a led matrix and so on.. but for now this is the more important thing.
Out of curiosity, what simulator?
Edit: I'm an old retired hippie also!
It wouldn't be FlightGear, would it? If so, I'm your guy.
simpler to add a gpio-expander - saves having multiple microcontrollers to program and interface
SPI/I2C port expanders (already mentioned) and shift registers come to mind for digital, analogue multiplexers for (guess what) analogue inputs.
If you want to use what you have, use the Leonardo or Micro for the USB. Both have a serial port (pins 0 and 1) that is independent of the USB. Your Uno/Nano can communicate over pins 0 and 1 as well (it will interfere with uploads to those boards) or you can use SoftwareSerial on any pins (except 0 and 1).
its iRacing haha
Yeah that would be ideal, but right now im in a super tight spot for extra money, so if at all possible id like to try to use the resources i have. ideally, id like to have the nano or the pro micro be this device
Okay awesome, so if im understanding this correct, i can use the Leonardo as the 'Brain' so to say, program that to read from the nano, and then with the nano i program that for basic button input reading and then tell it to send that over the serial port? im still learning how all this works too, so i apologize if its a super simple question to ask.
What type of USB device is iRacing expecting? Joystick? Text?
can use anything as far as i know, ive made a handbrake using a potentiometer, then had it interface as a joystick to windows and in the sim it just recognizes it as 'Device (X)' when binding it to a control. as long as its an input and can be recognized in 'windows game controller' (joy.cpl) it'll be available for mapping.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.