- Fri Dec 26, 2014 5:48 pm
#178078
Hi
I am trying to change a code from HMC6343 to hmc5883. I need the compass address for the following code
I am trying to change a code from HMC6343 to hmc5883. I need the compass address for the following code
Code: Select all
//Instruct compass to read echoes
Wire.beginTransmission(compassAddress); // transmit to device
// the address specified in the datasheet is 66 (0x42)
// but i2c adressing uses the high 7 bits so it's 33
Wire.write(0x50); // Send a "Post Heading Data" (0x50) command to the HMC6343
Wire.endTransmission(); // stop transmitting
//Wait for readings
delay(2); // datasheet suggests at least 1 ms
//Request heading reading from compass
Wire.requestFrom(compassAddress, 2); // request 2 bytes from slave device #33