Skip to content

Commit c7d645e

Browse files
committed
Updates to remaining examples
-All examples get updates necessary for SAMD51 compatibility -Added wait for Serial to setup -Changed INT/RST pins to A4/A5 -Changed begin to utilize INT/RST control -Updated comments on hardware hookups
1 parent 2c5f7e8 commit c7d645e

File tree

21 files changed

+419
-59
lines changed

21 files changed

+419
-59
lines changed

examples/Example_01_RotationVector/Example_01_RotationVector.ino

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ void setup() {
6767

6868
Wire.begin();
6969

70+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
7071
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
7172
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
7273
while (1)

examples/Example_02_Accelerometer/Example_02_Accelerometer.ino

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -36,14 +44,30 @@
3644
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
3745
BNO08x myIMU;
3846

47+
// For the most reliable interaction with the SHTP bus, we need
48+
// to use hardware reset control, and to monitor the H_INT pin.
49+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
50+
// Note, these can be other GPIO if you like.
51+
// Define as -1 to disable these features.
52+
#define BNO08X_INT A4
53+
//#define BNO08X_INT -1
54+
#define BNO08X_RST A5
55+
//#define BNO08X_RST -1
56+
57+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
58+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
59+
3960
void setup() {
4061
Serial.begin(115200);
62+
while(!Serial) delay(10); // Wait for Serial to become available.
63+
// Necessary for boards with native USB (like the SAMD51 Thing+).
4164
Serial.println();
4265
Serial.println("BNO08x Read Example");
4366

4467
Wire.begin();
4568

46-
if (myIMU.begin() == false) {
69+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
70+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4771
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4872
while (1)
4973
;

examples/Example_03_Gyro/Example_03_Gyro.ino

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,30 @@
3745

3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
while(!Serial) delay(10); // Wait for Serial to become available.
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
4265
Serial.println();
4366
Serial.println("BNO08x Read Example");
4467

4568
Wire.begin();
4669

47-
if (myIMU.begin() == false) {
70+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
71+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4872
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4973
while (1)
5074
;

examples/Example_04_Magnetometer/Example_04_Magnetometer.ino

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,30 @@
3745

3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
while(!Serial) delay(10); // Wait for Serial to become available.
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
4265
Serial.println();
4366
Serial.println("BNO08x Read Example");
4467

4568
Wire.begin();
4669

47-
if (myIMU.begin() == false) {
70+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
71+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4872
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4973
while (1)
5074
;

examples/Example_05_StepCounter/Example_05_StepCounter.ino

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,15 @@
2424
https://github.com/adafruit/Adafruit_BusIO
2525
2626
Hardware Connections:
27-
Plug the sensor into IoT RedBoard via QWIIC cable.
27+
IoT RedBoard --> BNO08x
28+
QWIIC --> QWIIC
29+
A4 --> INT
30+
A5 --> RST
31+
32+
BNO08x "mode" jumpers set for I2C (default):
33+
PSO: OPEN
34+
PS1: OPEN
35+
2836
Serial.print it out at 115200 baud to serial monitor.
2937
3038
Feel like supporting our work? Buy a board from SparkFun!
@@ -34,17 +42,32 @@
3442
#include <Wire.h>
3543

3644
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
37-
3845
BNO08x myIMU;
3946

47+
// For the most reliable interaction with the SHTP bus, we need
48+
// to use hardware reset control, and to monitor the H_INT pin.
49+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
50+
// Note, these can be other GPIO if you like.
51+
// Define as -1 to disable these features.
52+
#define BNO08X_INT A4
53+
//#define BNO08X_INT -1
54+
#define BNO08X_RST A5
55+
//#define BNO08X_RST -1
56+
57+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
58+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
59+
4060
void setup() {
4161
Serial.begin(115200);
62+
while(!Serial) delay(10); // Wait for Serial to become available.
63+
// Necessary for boards with native USB (like the SAMD51 Thing+).
4264
Serial.println();
4365
Serial.println("BNO08x Read Example");
4466

4567
Wire.begin();
4668

47-
if (myIMU.begin() == false) {
69+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
70+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4871
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4972
while (1)
5073
;

examples/Example_06_StabilityClassifier/Example_06_StabilityClassifier.ino

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525
https://github.com/adafruit/Adafruit_BusIO
2626
2727
Hardware Connections:
28-
Plug the sensor into IoT RedBoard via QWIIC cable.
28+
IoT RedBoard --> BNO08x
29+
QWIIC --> QWIIC
30+
A4 --> INT
31+
A5 --> RST
32+
33+
BNO08x "mode" jumpers set for I2C (default):
34+
PSO: OPEN
35+
PS1: OPEN
36+
2937
Serial.print it out at 115200 baud to serial monitor.
3038
3139
Feel like supporting our work? Buy a board from SparkFun!
@@ -37,14 +45,30 @@
3745
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
3846
BNO08x myIMU;
3947

48+
// For the most reliable interaction with the SHTP bus, we need
49+
// to use hardware reset control, and to monitor the H_INT pin.
50+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
51+
// Note, these can be other GPIO if you like.
52+
// Define as -1 to disable these features.
53+
#define BNO08X_INT A4
54+
//#define BNO08X_INT -1
55+
#define BNO08X_RST A5
56+
//#define BNO08X_RST -1
57+
58+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
59+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
60+
4061
void setup() {
4162
Serial.begin(115200);
63+
while(!Serial) delay(10); // Wait for Serial to become available.
64+
// Necessary for boards with native USB (like the SAMD51 Thing+).
4265
Serial.println();
4366
Serial.println("BNO08x Read Example");
4467

4568
Wire.begin();
4669

47-
if (myIMU.begin() == false) {
70+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
71+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
4872
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
4973
while (1)
5074
;

examples/Example_07_ActivityClassifier/Example_07_ActivityClassifier.ino

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@
3434
https://github.com/adafruit/Adafruit_BusIO
3535
3636
Hardware Connections:
37-
Plug the sensor into IoT RedBoard via QWIIC cable.
37+
IoT RedBoard --> BNO08x
38+
QWIIC --> QWIIC
39+
A4 --> INT
40+
A5 --> RST
41+
42+
BNO08x "mode" jumpers set for I2C (default):
43+
PSO: OPEN
44+
PS1: OPEN
45+
3846
Serial.print it out at 115200 baud to serial monitor.
3947
4048
Feel like supporting our work? Buy a board from SparkFun!
@@ -47,14 +55,30 @@
4755

4856
BNO08x myIMU;
4957

58+
// For the most reliable interaction with the SHTP bus, we need
59+
// to use hardware reset control, and to monitor the H_INT pin.
60+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
61+
// Note, these can be other GPIO if you like.
62+
// Define as -1 to disable these features.
63+
#define BNO08X_INT A4
64+
//#define BNO08X_INT -1
65+
#define BNO08X_RST A5
66+
//#define BNO08X_RST -1
67+
68+
#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
69+
//#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
70+
5071
void setup() {
5172
Serial.begin(115200);
73+
while(!Serial) delay(10); // Wait for Serial to become available.
74+
// Necessary for boards with native USB (like the SAMD51 Thing+).
5275
Serial.println();
5376
Serial.println("BNO08x Read Example");
5477

5578
Wire.begin();
5679

57-
if (myIMU.begin() == false) {
80+
//if (myIMU.begin() == false) { // Setup without INT/RST control (Not Recommended)
81+
if (myIMU.begin(BNO08X_ADDR, Wire, BNO08X_INT, BNO08X_RST) == false) {
5882
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
5983
while (1)
6084
;

examples/Example_08_AdvancedConfig/Example_08_AdvancedConfig.ino

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@
3535
GND --> GND
3636
SCL1 (D17) --> SCL
3737
SDA1 (D25) --> SDA
38+
A4 --> INT
39+
A5 --> RST
3840
3941
Note: Make sure to close the ADR jumper on the back of the board as well.
4042
@@ -49,6 +51,19 @@
4951
#include "SparkFun_BNO08x_Arduino_Library.h" // CTRL+Click here to get the library: http://librarymanager/All#SparkFun_BNO08x
5052
BNO08x myIMU;
5153

54+
// For the most reliable interaction with the SHTP bus, we need
55+
// to use hardware reset control, and to monitor the H_INT pin.
56+
// The H_INT pin will go low when its okay to talk on the SHTP bus.
57+
// Note, these can be other GPIO if you like.
58+
// Define as -1 to disable these features.
59+
#define BNO08X_INT A4
60+
//#define BNO08X_INT -1
61+
#define BNO08X_RST A5
62+
//#define BNO08X_RST -1
63+
64+
//#define BNO08X_ADDR 0x4B // SparkFun BNO08x Breakout (Qwiic) defaults to 0x4B
65+
#define BNO08X_ADDR 0x4A // Alternate address if ADR jumper is closed
66+
5267
// define some pins for our new I2C port, aka "Wire1"
5368
// on a SparkFun ESP32 IoT REdboard, these can be most pins, except those that
5469
// are only inputs.
@@ -57,6 +72,8 @@ BNO08x myIMU;
5772

5873
void setup() {
5974
Serial.begin(115200);
75+
while(!Serial) delay(10); // Wait for Serial to become available.
76+
// Necessary for boards with native USB (like the SAMD51 Thing+).
6077
Serial.println();
6178
Serial.println("BNO08x Read Example");
6279

@@ -69,7 +86,7 @@ void setup() {
6986
// The first argument of our BNO08x begin() function is the I2C address of the
7087
// sensor, either 0x4B (default) or 0x4A. The second is the TwoWire I2C port
7188
// to use. Wire, Wire1, etc.
72-
if (myIMU.begin(0x4A, Wire1) == false) {
89+
if (myIMU.begin(BNO08X_ADDR, Wire1, BNO08X_INT, BNO08X_RST) == false) {
7390
Serial.println("BNO08x not detected at default I2C address. Check your jumpers and the hookup guide. Freezing...");
7491
while (1)
7592
;

0 commit comments

Comments
 (0)