- Wed Feb 10, 2016 4:13 pm
#188042
Hi Guys,
I've been working a project, which involves using a CMPS11 digital compass. I'm an amateur at programming, so please excuse me for my silly questions.
I'm building a robot, which need to know its heading accurately. I chose I2C communication as the update rate of the signals has to be at least 15hz.
I used this program to read out the orientation:
http://www.robot-electronics.co.uk/htm/cmps11i2c.htm
As far as I know, the "angle full" would give me the heading. For some reasons, It's not accurate at all, actually, pretty useless. I want to calibrate the compass, but I'm stuck with it. I tried to send the commands in, but it doesn't seem to work. Can someone help me out and tell me what's wrong?
Tamas
I've been working a project, which involves using a CMPS11 digital compass. I'm an amateur at programming, so please excuse me for my silly questions.
I'm building a robot, which need to know its heading accurately. I chose I2C communication as the update rate of the signals has to be at least 15hz.
I used this program to read out the orientation:
http://www.robot-electronics.co.uk/htm/cmps11i2c.htm
As far as I know, the "angle full" would give me the heading. For some reasons, It's not accurate at all, actually, pretty useless. I want to calibrate the compass, but I'm stuck with it. I tried to send the commands in, but it doesn't seem to work. Can someone help me out and tell me what's wrong?
Code: Select all
Regards,#include <Wire.h>
#define ADDRESS 0x60
void setup(){
Wire.begin();
Serial.begin(9600);
}
void loop(){
}
void calibrate(){
Wire.beginTransmission(ADDRESS);
Wire.write(0xF0);
delay(25);
Wire.beginTransmission(ADDRESS);
Wire.write(0xF5);
delay(25);
Wire.beginTransmission(ADDRESS);
Wire.write(0xF6);
Wire.endTransmission();
delay(25);
}
Tamas