PmodNAV test

Dependencies:   mbed LPS25HB_I2C LSM9DS1 UsaPack

Revision:
1:e5d5afc20fe2
Parent:
0:c99eaed54c50
Child:
4:1f382a93d438
--- a/main.cpp	Mon Sep 27 09:02:40 2021 +0000
+++ b/main.cpp	Wed Oct 20 04:24:26 2021 +0000
@@ -2,20 +2,27 @@
 #include "LSM9DS1.h"
 #include "LPS.h"
 
-Serial pc(USBTX, USBRX, 57600);
-I2C i2c(PF_0, PF_1);
+Serial pc(USBTX, USBRX);
+Serial twelite(PE_8, PE_7);
+
+I2C i2c(PB_9, PB_8);
 LSM9DS1 lsm(i2c);
 LPS lps(i2c);
 
-using namespace std;
 
 int main()
 {
-    uint16_t reg = lsm.begin();
+    pc.baud(38400);
+    //enum gyro_scale gs;
+    //gs245 = G_SCALE_245DPS;
+    uint16_t reg = lsm.begin(lsm.G_SCALE_245DPS, lsm.A_SCALE_8G);
     //printf("%x\n", reg);
     if (!lps.init()){
-        printf("Failed to autodetect pressure sensor!\r\n");
-        while (1);
+        while (1)
+        {
+            pc.printf("Failed to autodetect pressure sensor!\r\n");
+            wait(2);
+        };
     }
     lps.enableDefault();
     wait_ms(100);
@@ -31,7 +38,7 @@
         float altitude = lps.pressureToAltitudeMeters(pressure);
         float temperature = lps.readTemperatureC();
         //printf("p:%.2f\t mbar\ta:%.2f m\tt:%.2f deg C\r\n",pressure,altitude,temperature);
-        printf("%f %f %f %f %f %f %f %f %f %f\n", lsm.ax, lsm.ay, lsm.az, lsm.gx, lsm.gy, lsm.gz, lsm.mx, lsm.my, lsm.mz, pressure);
+        pc.printf("%f %f %f %f %f %f %f %f %f %f\r\n", lsm.ax, lsm.ay, lsm.az, lsm.gx, lsm.gy, lsm.gz, lsm.mx, lsm.my, lsm.mz, pressure);
         wait(0.1);
     }
 }
\ No newline at end of file