Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed LPS25HB_I2C LSM9DS1 UsaPack
Revision 1:e5d5afc20fe2, committed 2021-10-20
- Comitter:
- osaka
- Date:
- Wed Oct 20 04:24:26 2021 +0000
- Parent:
- 0:c99eaed54c50
- Child:
- 4:1f382a93d438
- Commit message:
- test
Changed in this revision
| LSM9DS1.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/LSM9DS1.lib Mon Sep 27 09:02:40 2021 +0000 +++ b/LSM9DS1.lib Wed Oct 20 04:24:26 2021 +0000 @@ -1,1 +1,1 @@ -https://os.mbed.com/teams/HAPSRG/code/LSM9DS1/#9e0ac1cd9d79 +https://os.mbed.com/teams/HAPSRG/code/LSM9DS1/#8b71897cb24e
--- 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