Your explanation of the addresses makes sense and clears things up.
I realized I misread your first post and didn't catch the difference between your snippet and mine.
Quote:
Originally Posted by kylelanman
Code:
/* Arduino */
void receiveData(){
Wire.beginTransmission(0x52); //now at address 0x52
Wire.send(0x00); //send zero to signal we want info
Wire.endTransmission();
nunchuck)
Wire.requestFrom(0x52,6); //request the six bytes from the WM+
for (int i=0;i<6;i++){
data[i]=Wire.receive();
}
}
Code:
/* WPILib */
// _wmp is an instance of I2C
uint8_t buffer[6];
_wmp->Transaction(0x00, 1, buffer, sizeof(buffer);
|
Quote:
Originally Posted by Mike Bortfeldt
Code:
_wmp->Transaction(0x00, 0, buffer, sizeof(buffer));
|
With my 1 transaction call I was trying to kill 2 birds with one stone. The Wii MotionPlus requires that you send 0x00 in order for it to return data. That is why I was using a size of 1. Will this work all in one transaction or do we need to do 2 separate transactions. 1 for sending 0x0 and the other for receiving?
Thanks
Kyle