File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
examples/SimpleTemperature Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ /*
2+ Arduino LSM6DSOX - Simple Temperature
3+
4+ This example reads the temperature values from the LSM6DSOX
5+ sensor and continuously prints them to the Serial Monitor
6+ or Serial Plotter.
7+
8+ The circuit:
9+ - Arduino Nano RP2040 Connect
10+
11+ created 30 August 2021
12+ by Alexander Entinger
13+
14+ This example code is in the public domain.
15+ */
16+
17+ #include < Arduino_LSM6DSOX.h>
18+
19+ void setup ()
20+ {
21+ Serial.begin (9600 );
22+ while (!Serial);
23+
24+ if (!IMU.begin ())
25+ {
26+ Serial.println (" Failed to initialize IMU!" );
27+ while (1 );
28+ }
29+ }
30+
31+ void loop ()
32+ {
33+ if (IMU.temperatureAvailable ())
34+ {
35+ int temperature_deg = 0 ;
36+ IMU.readTemperature (temperature_deg);
37+
38+ Serial.print (" LSM6DSOX Temperature = " );
39+ Serial.print (temperature_deg);
40+ Serial.println (" °C" );
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments