|
|
|
![]() |
|
|||||||
|
||||||||
|
|
Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
I2C Arduino Port (Wii MotionPlus)
I'll start off by saying prior to this season our team has had no prior knowledge of I2C.
We successfully were able to talk to a LSM303D using the standard calls in the WPILib I2C class. We are now trying to integrate with a Wii MotionPlus. We have a working setup with an Arduino. In hopes of eliminating the Arduino we tried to port the Arduino sketch to C++. Our limited knowledge of I2C has made this a little bit of a challenge. 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();
}
}
1. Sending data over I2C with no register as a target. 2. Receiving data over I2C with out a particular register as a source. Code:
/* WPILib */
// _wmp is an instance of I2C
uint8_t buffer[6];
_wmp->Transaction(0x00, 1, buffer, sizeof(buffer);
Thanks in advance to anyone that can assist us. Kyle |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|