Star-Track/Firmware/MPU6050/examples/MPU6050_temperature/MPU6050_temperature.ino
2025-02-01 13:41:17 -08:00

39 lines
764 B
C++

/*
MPU6050 Triple Axis Gyroscope & Accelerometer. Temperature Example.
Read more: http://www.jarzebski.pl/arduino/czujniki-i-sensory/3-osiowy-zyroskop-i-akcelerometr-mpu6050.html
GIT: https://github.com/jarzebski/Arduino-MPU6050
Web: http://www.jarzebski.pl
(c) 2014 by Korneliusz Jarzebski
*/
#include <Wire.h>
#include <MPU6050.h>
MPU6050 mpu;
void setup()
{
Serial.begin(115200);
Serial.println("Initialize MPU6050");
while(!mpu.begin(MPU6050_SCALE_2000DPS, MPU6050_RANGE_2G))
{
Serial.println("Could not find a valid MPU6050 sensor, check wiring!");
delay(500);
}
}
void loop()
{
float temp = mpu.readTemperature();
Serial.print(" Temp = ");
Serial.print(temp);
Serial.println(" *C");
delay(500);
}