I'm working on an adaptation of Jason Leyrer's Guitar Hero Library for Arduino. My version is for a DJ Hero controller, and I've also borrowed some code from this Arduino forum thread: topic=120527 (sorry can't post links yet).
The protocol is i2c and I am successfully reading data from it, however I'm not 100% sure what to do with the data.
The buttons are fine, as they are mapped to just one bit in a given byte. However the other controls are a combination of 4, 5 and 6 bit longs.
The format according to Wiibrew is like so:
BE
is for Euphoria buttonCS
: Crossfade Slider, lower is left and upper is rightSX
andSY
are the black analog stick.ED
is the Effect DialRTT
is the turntable on the right as a 6-bit signed integer (positive = CW; negative = CCW)RBG
,RBR
,RBB
are the Green, Red and Blue buttons on the right- LTT is the turntable on the left as a 6-bit signed integer (positive = CW; negative = CCW)
LBG
,LBR
,LBB
are the Green, Red and Blue buttons on the left
I'm trying to do this:
signed long DJ_ED()
{
pack5 ED;
ED[0] = (DJ_buf[3] >> 5) & 1;
ED[1] = (DJ_buf[3] >> 6) & 1;
ED[2] = (DJ_buf[3] >> 7) & 1;
ED[3] = (DJ_buf[2] >> 5) & 1;
ED[4] = (DJ_buf[2] >> 6) & 1;
return ED;
}
Where pack5 is the following:
#define packet5
union pack5
{
signed long value;
int ints[5];
};
but I'm getting the following error:
no match for 'operator[]' (operand types are 'pack5' and 'int')
What am I doing wrong?