Skip to content

Instantly share code, notes, and snippets.

@hunterloftis
Created December 12, 2011 02:09
Show Gist options
  • Save hunterloftis/1464297 to your computer and use it in GitHub Desktop.
Save hunterloftis/1464297 to your computer and use it in GitHub Desktop.
// Activate WM+
Serial.println("Intitializing MP");
Wire.beginTransmission(0x52);
Serial.println("1");
Wire.send(0xf0);
Serial.println("2");
Wire.send(0x55);
Serial.println("3");
Wire.endTransmission();
Serial.println("4");
delay(250);
// Activate WM+ in NC passthrough mode
Serial.println("Setting mode: passthrough");
Wire.begin();
Wire.beginTransmission(0x53); // Why 0x53 here and 0x52 later?
Wire.send(0xfe);
Wire.send(0x05);
Wire.endTransmission(); // WM+ jumps to address 0x52 and is now active
delay(250);
// Set reading address
Serial.print ("Setting reading address at 0xFA");
Wire.beginTransmission(0x52); //0xA4
Wire.send(0xfa);
Wire.endTransmission();
delay(250);
// Read ID of WMP
Serial.println("Reading MP ID");
Wire.requestFrom(0x52, 6);
int xID = 0;
for(int i = 0; i < 6; i++) {
data[i] = Wire.receive();
xID += data[i];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment