Hi there,
i have a strange problem when i try to interface my DJ Hero Turntable or Guitar Hero World Tour Controller with my Arduino Uno.
I have written the following sample code which schould just initialize the Controller and print me the six byte i request into the serial console:
#include <Wire.h>
#define BAUDRATE 19200
#define ADDRESS 0x52
void setup()
{
Serial.begin(BAUDRATE);
Wire.begin();
Wire.beginTransmission(ADDRESS);
Wire.write(0xF0);
Wire.write(0x55);
Wire.endTransmission();
delay(1);
Wire.beginTransmission(ADDRESS);
Wire.write(0xFB);
Wire.write((uint8_t)0x00);
Wire.endTransmission();
}
void loop()
{
int count = 0;
int values[6];
Wire.requestFrom (ADDRESS, 6);
while(Wire.available())
{
values[count] = Wire.read();
count++;
}
Serial.println(values[0], BIN);
Serial.println(values[1], BIN);
Serial.println(values[2], BIN);
Serial.println(values[3], BIN);
Serial.println(values[4], BIN);
Serial.println(values[5], BIN);
Serial.println("-------------------");
Wire.beginTransmission(ADDRESS);
Wire.write((uint8_t)0x00);
Wire.write((uint8_t)0x00);
Wire.endTransmission();
delay(1000);
}
That works, except for that i miss the first byte which holds (for example) information about the x-axis of the controllers analoge stick.
That means in my case the last byte is always 0 and the byte before are shifter one position higher (so the first byte is not there and the second ist now first).
I tried the same code with my Guitar Hero controller and have the same problem.
But the code works with the Nintendo Nunchuk.
The only really valuable Information regarding the controller i got from Wiimote/Extension Controllers/DJ Hero (Wii) Turntable - WiiBrew
Has anybody a idea what could be wrong with my code?
Problem exists with Arduino 1.0 and 1.01 on Mac OS X.