Hi, i am new to arduino but know a bit of C so the language wasn't hard to pick up. I was looking around for something to do with my new arduino and noticed my old sega genesis/megadrive controllers. i got a pinout from pinouts.ru and hooked it up to the arduino. I have genesis pins 7 and 8 connected to ground and pin 5 connected to 5v. pin 1-6(excluding 5) are connected to digital 1-5 respectively. I do not know much about how coontrollers work, my program is just supposed to display what if a button is being pressed after reading it, if it is not pressed the output is "none".For some reason, it always senses left and start when they are read even if they are not pressed and it never senses right even when it is pressed. If anyone can help me understand more about the genesis controllers or can help me optimize my code that would be greatly appreciated. this is my code:

ok, that code isnt going to do anything. you are reading the output lines without driving the input lines. the gamepad expects a control signal to be put into it before anything will happen. let me read up on it and ill get back with how to drive it.

http://www.msarnoff.org/gen2usb/ <-- protocol info

ok. so it looks like all you have to do is provide power and drive the Sel line high and low

like this

void setup(){pinMode(selpin, OUTPUT);}

void loop(){digitalWrite(selpin,HIGH);//code to read the outputs.digitalWrite(selpin,LOW);//read the output pins again, but keep in mind the buttons read are different}

also, using a bunch of ints is an inefficient way of using data. integers hold 16 bits of data. each button state is a 1 or a 0, so you only need 1 bit to store its value. look at the bitRead() and bitWrite() functions. they will let you write a 1 or a 0 to a bit in a variable instead of using all the bits to store 1 value. you will need 1 bit per button, so for 10 bits you can get away with using an 1 integer instead of 10 of them.

still, when i press nothing it read right and left and then when i press other buttons it never reads the right thing or just doesn't read at all. i will recheck my wiring but i think it is right. this probably has something to do with that switching pin, even though i thought i had accounted for that in the code, maybe not. thanks for your help.

I see what you are doing with that code, using loops to read input into reading twice once with select high once with low. Although it still isn't working, i am just getting a bunch of 6,3, and 10's no matter what i press. i think it might be the wiring, they don't fit in the sockets too tight and i think that might be causing strange data and noise to come through. thanks for your help though, your code really does help me understand it better.

its completely possible. if you have some led's and resistors laying around you might throw together a quick circuit to check things out. tie select to high, wire ground and +5, then hook the led's up with negative lead on the controller, and positive to +5 volts. since the output goes low when the button is pressed only the led that is hooked up to the button will light up, as opposed to every led lighting except for the button you pressed.

it definitely is static, the LEDS would not light up but i could jiggle the connector and they would light up and blink and do all sorts of things. so the signal obviously isn't good. guess i need larger leads. thanks for your help anyways.