Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Calibrating Arduino Robot compass (old version, Honeywell HMC 6352)
#include <Wire.h>
#define ADDRESS 0x21
void setup(){
Wire.begin();
Serial.begin(9600);
while(!Serial);
calibrate();
}
void loop(){
}
void calibrate(){
Serial.println("Calibration Mode");
delay(1000); //1 second before starting
Serial.println("Start");
Wire.beginTransmission(ADDRESS);
Wire.write(0x43);
Wire.endTransmission();
for(int i=0;i<15;i++){ //15 seconds
Serial.println(i);
delay(1000);
}
Wire.beginTransmission(ADDRESS);
Wire.write(0x45);
Wire.endTransmission();
Serial.println("done");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.