Wiring Forum
http://wiring.org.co/cgi-bin/yabb/YaBB.pl
Programming Questions & Help >> Programs >> i2c write value to register
http://wiring.org.co/cgi-bin/yabb/YaBB.pl?num=1241296423

Message started by Kars on 05/02/09 at 20:33:43

Title: i2c write value to register
Post by Kars on 05/02/09 at 20:33:43
Hey all,

Im using a CMPS03 compass sensor ( link rev 7)
The documentation says I can calibrate my compass sensor via I2C
I have to write 0xFF to register 15, but I don't know how to write a value to a register.

I've tried this code but it doens't seem to work

Code:
  Serial.println("Set to north");
 delay(5000);
 Wire.beginTransmission(0x60);
 Wire.send(0x0C);
 Wire.send(0xFF);
 Wire.endTransmission();      

 Serial.println("Set to east");
 delay(5000);  
 Wire.beginTransmission(0x60);
 Wire.send(0x0C);
 Wire.send(0xFF);
 Wire.endTransmission();    
 
 Serial.println("Set to south");
 delay(5000);  
 Wire.beginTransmission(0x60);
 Wire.send(0x0C);
 Wire.send(0xFF);
 Wire.endTransmission();    

 Serial.println("Set to west");
 delay(5000);  
 Wire.beginTransmission(0x60);
 Wire.send(0x0C);
 Wire.send(0xFF);
 Wire.endTransmission();    


Does someone know how to write a value to a register?

Wiring Forum » Powered by YaBB 2.5 AE!
YaBB Forum Software © 2000-2010. All Rights Reserved.