Me wearing ridiculous goggles

XBOX 360 Chatpad Arduino Library

This library makes the XBOX 360 chatpad work with Arduino. The chatpad needs only one serial port, plus power and ground. I hooked mine up by soldering a cable to its internal PCB, but you could also solder to the connector, or adapt the mating connector from inside a 360 controller. Here’s my setup (attached to an Android Device Kit, which is basically an Arduino Mega 2560):

Image of wires coming out of the chatpad and going to the ADK

Image of wires coming out of the chatpad and going to the ADK

For specifics on how to connect the chatpad, see my information on the pinout.

Library

Download Chatpad.zip (4.8KiB) and install it like any other Arduino library (follow the library installation instructions).

Example

This sketch just echoes keys to the Serial Monitor (at 57600 bps). It assumes the Chatpad is hooked to Serial 3, like in the picture above. Change the line in setup to point it at a different port.

#include <Chatpad.h>

Chatpad pad;

void print_keys(Chatpad &pad, Chatpad::keycode_t code,
    Chatpad::eventtype_t type) {
  if (type == Chatpad::Down) {
    char a = pad.toAscii(code);
    if (a != 0) Serial.print(a);
  }
}

void setup() {
  Serial.begin(57600);
  pad.init(Serial3, print_keys);
}

void loop() {
  pad.poll();
}

More Cliffle

By Topic