Home \ Help \ Search \ Login RSS

Welcome, Guest. Please Login

This forum is now READ-ONLY! Please visit http://forum.wiring.co/ for the new forum.

Wiring ForumProgramming Questions & HelpPrograms › i2c write value to register

Page Index Toggle Pages: 1
i2c write value to register (Read 8858 times)
05/02/09 at 20:33:43

Kars   Offline
YaBB Newbies
Team Vossius
Amsterdam

Posts: 19
*
 
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?
 

Buildig the same as Titus ^^
IP Logged
 
Page Index Toggle Pages: 1