-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExample8_SelfTest.ino
60 lines (46 loc) · 1.44 KB
/
Example8_SelfTest.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
/*
SPDX-License-Identifier: MIT
Copyright (c) 2024 SparkFun Electronics
*/
/*******************************************************************************
Example 8 - Self Test
This example demonstrates how to perform a self test of the SparkFun Qwiic
Optical Tracking Odometry Sensor (OTOS).
The self test triggers the OTOS to perform a series of tests to ensure the
sensor is functioning correctly. This is performed during QC testing, but
you can also perform this test yourself.
*******************************************************************************/
#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 8 - Self Test");
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!");
Serial.println("The OTOS must be stationary during the self test!");
// Perform the self test
sfTkError_t result = myOtos.selfTest();
// Check if the self test passed
if (result == ksfTkErrOk)
{
Serial.println("Self test passed!");
}
else
{
Serial.println("Self test failed!");
}
}
void loop()
{
// Nothing to do in this example
}