Skip to content

Commit b4b3bac

Browse files
committed
update keyword + add example
addition of uncalibrated gyro functions
1 parent b1ab503 commit b4b3bac

File tree

2 files changed

+85
-0
lines changed

2 files changed

+85
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*
2+
Using the BNO080 IMU
3+
By: Bastien Boudet
4+
Date: February 3rd, 2022
5+
SparkFun code, firmware, and software is released under the MIT License.
6+
Please see LICENSE.md for further details.
7+
8+
Feel like supporting our work? Buy a board from SparkFun!
9+
https://www.sparkfun.com/products/14586
10+
11+
This example shows how to output the parts of the uncalibrated gyro.
12+
13+
It takes about 1ms at 400kHz I2C to read a record from the sensor, but we are polling the sensor continually
14+
between updates from the sensor. Use the interrupt pin on the BNO080 breakout to avoid polling.
15+
16+
Hardware Connections:
17+
Attach the Qwiic Shield to your Arduino/Photon/ESP32 or other
18+
Plug the sensor onto the shield
19+
Serial.print it out at 115200 baud to serial monitor.
20+
*/
21+
22+
#include <Wire.h>
23+
24+
#include "SparkFun_BNO080_Arduino_Library.h" // Click here to get the library: http://librarymanager/All#SparkFun_BNO080
25+
BNO080 myIMU;
26+
27+
void setup()
28+
{
29+
Serial.begin(115200);
30+
Serial.println();
31+
Serial.println("BNO080 Read Example");
32+
33+
Wire.begin();
34+
35+
myIMU.begin();
36+
37+
Wire.setClock(400000); //Increase I2C data rate to 400kHz
38+
39+
myIMU.enableUncalibratedGyro(50); //Send data update every 50ms
40+
41+
Serial.println(F("Uncalibrated Gyro enabled"));
42+
Serial.println(F("Output in form x, y, z, bx, by, bz in radians per second"));
43+
}
44+
45+
void loop()
46+
{
47+
//Look for reports from the IMU
48+
if (myIMU.dataAvailable() == true)
49+
{
50+
float x = myIMU.getUncalibratedGyroX();
51+
float y = myIMU.getUncalibratedGyroY();
52+
float z = myIMU.getUncalibratedGyroZ();
53+
float bx = myIMU.getUncalibratedGyroBiasX();
54+
float by = myIMU.getUncalibratedGyroBiasY();
55+
float bz = myIMU.getUncalibratedGyroBiasZ();
56+
57+
58+
Serial.print(x, 2);
59+
Serial.print(F(","));
60+
Serial.print(y, 2);
61+
Serial.print(F(","));
62+
Serial.print(z, 2);
63+
Serial.print(F(","));
64+
65+
Serial.print(bx, 2);
66+
Serial.print(F(","));
67+
Serial.print(by, 2);
68+
Serial.print(F(","));
69+
Serial.print(bz, 2);
70+
Serial.print(F(","));
71+
72+
Serial.println();
73+
}
74+
}

keywords.txt

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ enableARVRStabilizedRotationVector KEYWORD2
3939
enableARVRStabilizedGameRotationVector KEYWORD2
4040
enableAccelerometer KEYWORD2
4141
enableGyro KEYWORD2
42+
enableUncalibratedGyro KEYWORD2
4243
enableMagnetometer KEYWORD2
4344
enableTapDetector KEYWORD2
4445
enableStepCounter KEYWORD2
@@ -75,6 +76,16 @@ getGyroY KEYWORD2
7576
getGyroZ KEYWORD2
7677
getGyroAccuracy KEYWORD2
7778

79+
getUncalibratedGyro KEYWORD2
80+
getUncalibratedGyroX KEYWORD2
81+
getUncalibratedGyroY KEYWORD2
82+
getUncalibratedGyroZ KEYWORD2
83+
getUncalibratedGyroAccuracy KEYWORD2
84+
getUncalibratedGyroBiasX KEYWORD2
85+
getUncalibratedGyroBiasY KEYWORD2
86+
getUncalibratedGyroBiasZ KEYWORD2
87+
88+
7889
getFastGyro KEYWORD2
7990
getFastGyroX KEYWORD2
8091
getFastGyroY KEYWORD2

0 commit comments

Comments
 (0)