The PS2 Controller Adapter Board is a versatile circuit board designed to interface a PlayStation 2 (PS2) controller with various devices, such as computers or custom electronics projects. This adapter board simplifies the process of integrating the PS2 controller into your projects, providing a reliable and efficient way to utilize the controller's inputs.
Specification | Value |
---|---|
Operating Voltage | 5V |
Communication | Serial (SPI) |
Connector Type | PS2 Controller Port |
Dimensions | 50mm x 30mm x 10mm |
Power Consumption | < 100mA |
Pin Number | Pin Name | Description |
---|---|---|
1 | VCC | Power supply (5V) |
2 | GND | Ground |
3 | DATA | Serial data line (MISO) |
4 | CMD | Command line (MOSI) |
5 | ATT | Attention line (Chip Select) |
6 | CLK | Clock line (SCK) |
7 | ACK | Acknowledge line (Interrupt) |
#include <PS2X_lib.h> // Include PS2X library
PS2X ps2x; // Create PS2 Controller Class
#define PS2_DAT 12 // MISO
#define PS2_CMD 11 // MOSI
#define PS2_SEL 10 // CS
#define PS2_CLK 13 // SCK
void setup() {
Serial.begin(9600);
// Initialize controller
int error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, true, true);
if(error == 0) {
Serial.println("PS2 Controller successfully connected!");
} else {
Serial.println("Error connecting PS2 Controller.");
}
}
void loop() {
ps2x.read_gamepad(false, 0); // Read controller data
if(ps2x.Button(PSB_START)) {
Serial.println("Start button pressed");
}
delay(50); // Small delay to prevent overwhelming the serial output
}
No Response from Controller:
Erratic Behavior:
Initialization Errors:
By following this documentation, users can effectively integrate the PS2 Controller Adapter Board into their projects, ensuring reliable performance and functionality.