Created
January 12, 2014 00:10
-
-
Save Robotonics/8378707 to your computer and use it in GitHub Desktop.
This file contains 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
byte highByte; | |
byte lowByte; | |
? | |
Wire.beginTransmission(address); //starts communication with cmps03 | |
Wire.write(2); //Sends the register we wish to read | |
Wire.endTransmission(); | |
? | |
Wire.requestFrom(address, 2); //requests high byte | |
while(Wire.available() < 2); //while there is a byte to receive | |
highByte = Wire.read(); //reads the byte as an integer | |
lowByte = Wire.read(); | |
int bearing = ((highByte<<8)+lowByte)/10; | |
double conversion = (bearing*3.14159)/180; | |
? | |
Serial.println(conversion,5); | |
delay(100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment