Skip to content

Commit 8c603ae

Browse files
committed
Add version example
1 parent ab1f0bf commit 8c603ae

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#include "SparkFun_Qwiic_OTOS_Arduino_Library.h"
2+
#include "Wire.h"
3+
4+
// Create an OTOS object
5+
QwiicOTOS myOtos;
6+
7+
void setup()
8+
{
9+
// Start serial
10+
Serial.begin(115200);
11+
Serial.println("Qwiic OTOS Example 7 - Get Version");
12+
13+
Wire.begin();
14+
15+
// Attempt to begin the sensor
16+
while (myOtos.begin() == false)
17+
{
18+
Serial.println("OTOS not connected, check your wiring and I2C address!");
19+
delay(1000);
20+
}
21+
22+
Serial.println("OTOS connected!");
23+
24+
// Get the hardware and firmware version
25+
otos_version_t hwVersion;
26+
otos_version_t fwVersion;
27+
myOtos.getVersionInfo(hwVersion, fwVersion);
28+
29+
// Print the hardware and firmware version
30+
Serial.print("OTOS Hardware Version: v");
31+
Serial.print(hwVersion.major);
32+
Serial.print(".");
33+
Serial.println(hwVersion.minor);
34+
Serial.print("OTOS Firmware Version: v");
35+
Serial.print(fwVersion.major);
36+
Serial.print(".");
37+
Serial.println(fwVersion.minor);
38+
}
39+
40+
void loop()
41+
{
42+
// Nothing to do in this example
43+
}

0 commit comments

Comments
 (0)