I2C library for Bosch BNO055 sensor

Dependents:   Project Campus_Safety_Bot

Fork of BNO055 by Dave Turner

Revision:
2:695c6e5d239a
Parent:
1:2c3322a8d417
Child:
3:1db1628eb8b2
--- a/BNO055.cpp	Sat May 30 18:36:36 2015 +0000
+++ b/BNO055.cpp	Sat May 30 19:08:59 2015 +0000
@@ -194,6 +194,19 @@
     quat.z = float(quat.rawz)/16384.0f;
 }
 
+void BNO055::get_angles(void){
+    tx[0] = BNO055_EULER_H_LSB_ADDR;
+    _i2c.write(address,tx,1,true);  
+    _i2c.read(address+1,rawdata,6,0); 
+    angles.rawyaw = (rawdata[1] << 8 | rawdata[0]);
+    angles.rawroll = (rawdata[3] << 8 | rawdata[2]);
+    angles.rawpitch = (rawdata[5] << 8 | rawdata[4]);
+    angles.yaw = float(angles.rawyaw)*angle_scale;
+    angles.roll = float(angles.rawroll)*angle_scale;
+    angles.pitch = float(angles.rawpitch)*angle_scale;
+}
+
+
 void BNO055::get_temp(void){
     readchar(BNO055_TEMP_ADDR);
     temperature = rx / temp_scale;