0

For a robotics project I am using an MCP23017 I/O Port Expander in order to have more pins available, and I am also using a PS2 controller for input. Both of these require pins 4 and 5 (because these are the data and clock pins). I was wondering if I can use a breadboard to simply connect these two pins to both devices in order to provide both of them with data and clock pins.

I am using an Arduino UNO and a playstation 2 controller with the following guide: http://www.techmonkeybusiness.com/using-a-playstation-2-controller-with-your-arduino-project.html

  • 1
    Nowhere in that link does it mention using the I2C pins. The PS2 uses a bitbanged custom protocol. It can use any pins. You can only use I2C pins for I2C. – Majenko Mar 8 '18 at 20:49
1

You are confusing pins here. In the library you mention there is a function call to set up the gamepad:

 ps2x.config_gamepad(5,4,3,2, false, false);
 //setup pins and settings: GamePad(clock, command, attention, data, Pressures, Rumble)

That is digital pins 5, 4, 3 and 2.

I2C uses analog input pins A4 and A5 on the other side of your Uno board.

1

An I2C bus can be connected to many slaves at the same time, since in the I2C protocol every slave has an address.

But, as Majenko wrote in the comments, the library for the PS2 controller doesn't use I2C. The communication with the controller is bit banged, meaning that every part of the communication is done by software. This can be done with every digital pin on the Arduino. In your setup you have to usw the function ps2x.config_gamepad(). In it's parameters you can set the pins that the library will use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.