Created
May 24, 2021 14:25
M5StickC_IMU_Serial.print_5msecPeriod
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <M5StickC.h> | |
float accX = 0.0F; | |
float accY = 0.0F; | |
float accZ = 0.0F; | |
float gyroX = 0.0F; | |
float gyroY = 0.0F; | |
float gyroZ = 0.0F; | |
float pitch = 0.0F; | |
float roll = 0.0F; | |
float yaw = 0.0F; | |
void setup() { | |
// put your setup code here, to run once: | |
M5.begin(); | |
M5.IMU.Init(); | |
//Serial.setRotation(3); | |
//Serial.fillScreen(BLACK); | |
//Serial.setTextSize(1); | |
//Serial.setCursor(40, 0); | |
Serial.println("IMU TEST"); | |
// Serial.setCursor(0, 10); | |
Serial.println(" X Y Z"); | |
//Serial.setCursor(0, 50); | |
Serial.println(" Pitch Roll Yaw"); | |
} | |
float temp = 0; | |
/***************************************** | |
M5.IMU.getGyroData(&gyroX,&gyroY,&gyroZ); | |
M5.IMU.getAccelData(&accX,&accY,&accZ); | |
M5.IMU.getAhrsData(&pitch,&roll,&yaw); | |
M5.IMU.getTempData(&temp); | |
*****************************************/ | |
void loop() { | |
// put your main code here, to run repeatedly: | |
M5.IMU.getGyroData(&gyroX,&gyroY,&gyroZ); | |
M5.IMU.getAccelData(&accX,&accY,&accZ); | |
M5.IMU.getAhrsData(&pitch,&roll,&yaw); | |
M5.IMU.getTempData(&temp); | |
//Serial.setCursor(0, 20); | |
//Serial.printf("%6.2f,%6.2f,%6.2f,", gyroX, gyroY, gyroZ); | |
//Serial.setCursor(140, 20); | |
//Serial.print("o/s"); | |
//Serial.setCursor(0, 30); | |
Serial.printf("%5.2f,%5.2f,%5.2f,", accX, accY, accZ); | |
//Serial.setCursor(140, 30); | |
//Serial.print("G"); | |
//Serial.setCursor(0, 60); | |
Serial.printf("%5.2f,%5.2f,%5.2f,", pitch, roll, yaw); | |
Serial.println(millis()); | |
//Serial.setCursor(0, 70); | |
//Serial.printf("Temperature : %.2f C", temp); | |
//delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment