Created
June 10, 2014 12:13
-
-
Save X-Y/ca3d047fe7db75582bac to your computer and use it in GitHub Desktop.
Calibrating Arduino Robot compass (old version, Honeywell HMC 6352)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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