Let me just explain what I am doing first. I am going to use an Arduino in an arcade stick to be used to playing fighting games like Street Fighter for various systems. The Arduino is mainly going to be used for LED programming, but I was thinking that I could use the board also to switch between the different PCB's. So here's what I am thinking.
The different boards I am using for each system are all common ground, so I was going to have VCC and Ground powered to all boards at all times. When the stick is plugged in and no buttons are pressed, it will default to send the data signals to one board. If certain buttons are pressed when the stick is plugged in, the data signals are sent to a different board.
Now, I figured this could have been checked in the setup function to see if the buttons are high, but from there, I'm not sure how I would go about telling the Arduino which board to send the data lines to, which is why I am coming here for help to ask for any suggestions how I would go about coding this.
Any help would be appreciated at this is my first project with an Arduino, thanks!
How many data signals are there for each board, and how many boards?
And whar type of data signal ? simple buttons ? joysticks ? others ?
Two boards, each board has 2 data signals.
The stick will be digital using push-buttons and a joystick with 4 signals for the different directions.
I am not too sure what you are asking but supposed to have two outputs like pin 6 and pin 8, you direct data to them with a simple if statement:-
val = // what ever state you want to send
if(controller1) digitalWrite(pin6, val); else digitalWrite(pin8, val);
Where controller1 is a boolean variable you set up previously depending one what is plugged in.
Maybe I didn't explain it too clearly prior. What I was planning on doing was having a microcontroller dedicated for use with a PS3 and another for the Wii both hooked to an Arduino. I wanted either the Arduino to autodetect which system it was plugged into and send the data lines to the correct board, or if I needed, to have the data lines go to one system by default and, if say I pushed a button down while plugging the joystick in, it would send the data to the other system. I'm not sure if the if statement that you referenced earlier matters, but once it's determined what system the Arduino is plugged into, I need all the data coming from either the PS3 or Wii to be directed to the appropriate board.
I asked a guy who frequents the fighting game forum I am on who has some experience with Arduinos, and he had this to say..
"you can use the Wire.h library and there are a few HID libraries for hardware signature and address
there is a sweet ps3 servo library.
essentially what you could do is simply detect the PS3 otherwise its the other system if you are only concerned about binary selection
i have used the above library dumped onto a ATMEGA328 with the Arduino Bootloader on a standalone breadboard app.
btw, the wiimote library also works on the wii classic controller, you will have to search for the modded library, but is works.
lastly, search for USB HID arduino, alot of people use I2C"
So anyway, I guess this gives me some sort of idea on a direction for this once I get a better understanding of everything I've read. I appreciate the suggestions so far, thanks!
Wire all your output pins to both devices. Simply use an AND gate (and optionally an inverting-AND gate) for each control line.
Turn on the 2nd input to the AND gate when you push the device selection button.
That's a hardware based solution, but it would be extreemely simple and cheap to implement.