-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample7_GetVersion.ino
62 lines (49 loc) · 1.75 KB
/
Example7_GetVersion.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/*
SPDX-License-Identifier: MIT
Copyright (c) 2024 SparkFun Electronics
*/
/*******************************************************************************
Example 7 - Get Version
This example demonstrates how to get the hardware and firmware version
numbers from the SparkFun Qwiic Optical Tracking Odometry Sensor (OTOS).
There may be future hardware and/or firmware changes of the OTOS, so you can
use this example to check which version you have. See the product page or
hardware repository to see what the latest version is:
https://www.sparkfun.com/products/24904
https://github.com/sparkfun/SparkFun_Optical_Tracking_Odometry_Sensor
*******************************************************************************/
#include "SparkFun_Qwiic_OTOS_Arduino_Library.h"
#include "Wire.h"
// Create an OTOS object
QwiicOTOS myOtos;
void setup()
{
// Start serial
Serial.begin(115200);
Serial.println("Qwiic OTOS Example 7 - Get Version");
Wire.begin();
// Attempt to begin the sensor
while (myOtos.begin() == false)
{
Serial.println("OTOS not connected, check your wiring and I2C address!");
delay(1000);
}
Serial.println("OTOS connected!");
// Get the hardware and firmware version
sfe_otos_version_t hwVersion;
sfe_otos_version_t fwVersion;
myOtos.getVersionInfo(hwVersion, fwVersion);
// Print the hardware and firmware version
Serial.print("OTOS Hardware Version: v");
Serial.print(hwVersion.major);
Serial.print(".");
Serial.println(hwVersion.minor);
Serial.print("OTOS Firmware Version: v");
Serial.print(fwVersion.major);
Serial.print(".");
Serial.println(fwVersion.minor);
}
void loop()
{
// Nothing to do in this example
}