Arduino frameworks

- AltSoftSerial UART with WT61 IMU
- UART with Pi on TX0/RX0 (and USB)
This commit is contained in:
Mikkeli Matlock
2026-02-01 11:47:15 +09:00
parent 7a6e69861b
commit 559e62e292
6 changed files with 356 additions and 26 deletions

31
arduino/main/imu.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef IMU_H
#define IMU_H
#include <Arduino.h>
// WT61 IMU data structure
struct ImuData {
// Acceleration (g)
float ax, ay, az;
// Angular velocity (deg/s)
float gx, gy, gz;
// Euler angles (degrees)
float roll, pitch, yaw;
// Timestamp of last valid packet (millis)
unsigned long lastUpdate;
};
// Initialize IMU serial (call in setup)
void imu_init();
// Process incoming bytes - call frequently in loop
// Returns true if new complete packet was parsed
bool imu_update();
// Get latest IMU data
const ImuData& imu_get_data();
// Check if IMU data is fresh (updated within timeout_ms)
bool imu_is_fresh(unsigned long timeout_ms = 200);
#endif