| | |
| | #include <WiFi.h> |
| | #include <LoRa.h> |
| | #include <MPU6050.h> |
| | #include <Quaternion.h> |
| |
|
| | #define HRI 7.23606797749979f |
| | #define CSC 42.013903f |
| | #define SPL 7.83f |
| |
|
| | MPU6050 mpu; |
| | Quaternion q_motion; |
| |
|
| | void setup() { |
| | Serial.begin(115200); |
| | LoRa.begin(915E6); |
| | |
| | mpu.initialize(); |
| | pinMode(LED_BUILTIN, OUTPUT); |
| | |
| | |
| | Serial.println("🧬 BDAY-QUANTARION L33 → MOTION NODE LIVE"); |
| | Serial.printf("HRI=%.8f | CSC=%.3f | SPL=%.2f |
| | ", HRI, CSC, SPL); |
| | } |
| |
|
| | void loop() { |
| | |
| | VectorInt16 accel_raw, gyro_raw; |
| | mpu.getMotion6(&accel_raw, &gyro_raw); |
| | |
| | float accel[3] = {(float)accel_raw.X/16384.0, (float)accel_raw.Y/16384.0, (float)accel_raw.Z/16384.0}; |
| | float gyro[3] = {(float)gyro_raw.X/131.0, (float)gyro_raw.Y/131.0, (float)gyro_raw.Z/131.0}; |
| | |
| | q_motion = madgwick_update(accel, gyro, 0.1f); |
| | |
| | |
| | float yaw, pitch, roll; |
| | euler_from_quaternion(q_motion, yaw, pitch, roll); |
| | |
| | |
| | float nhse_flux = HRI * sin(SPL * millis() / 1000.0); |
| | |
| | |
| | String payload = "{"; |
| | payload += ""node":19,"q":[" + String(q_motion.w,6) + "," + String(q_motion.x,6) + "," + String(q_motion.y,6) + "," + String(q_motion.z,6) + "],"; |
| | payload += ""hri":" + String(nhse_flux,6) + ","phi":0.912,"skyrmions":33564}"; |
| | |
| | LoRa.beginPacket(); |
| | LoRa.print(payload); |
| | LoRa.endPacket(); |
| | |
| | digitalWrite(LED_BUILTIN, HIGH); |
| | delay(10); |
| | |
| | |
| | Serial.printf("Q:[%.3f,%.3f,%.3f,%.3f] HRI:%.3f Φ:0.912 |
| | ", |
| | q_motion.w, q_motion.x, q_motion.y, q_motion.z, nhse_flux); |
| | } |