StarGate01 / ArduinoPSX

A Playstation 2 controller library for Arduino

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ArduinoPSX

A Playstation 2 controller library for Arduino.

Features

  • Read digital button states
  • Read analog joystick values
  • Set and lock digital / analog mode
  • Turn off vibration motors to save energy

Usage

For wire colors and wiring, refer to https://store.curiousinventor.com/guides/PS2. Make sure to connect all the power and ground wires!

A timing delay of 10 microseconds is usually fine.

PSX psx;
PSX::PSXDATA PSXdata;
int PSXerror;

psx.setupPins(dataPin, cmdPin, attPin, clockPin, delay);
psx.config(PSXMODE_ANALOG);

PSXerror = psx.read(PSXdata);
if(PSXerror == PSXERROR_SUCCESS)
{
    byte test = PSXdata.JoyLeftX;
    boolean test2 = (PSXdata.buttons & PSXBTN_LEFT);
}

Check the example code or source code documentation for all available attributes.

Available on

Thanks to / Sources:

About

A Playstation 2 controller library for Arduino

License:GNU General Public License v3.0


Languages

Language:C++ 100.0%