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.
Fork of LSM9DS1_Demo by
Revision 1:acf696b18c52, committed 2016-06-16
- Comitter:
- 5hel2l2y
- Date:
- Thu Jun 16 20:07:34 2016 +0000
- Parent:
- 0:9632b831b6c1
- Child:
- 2:78df20bf0af3
- Commit message:
- Modified to work with LSM6DS3
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LSM6DS3.lib Thu Jun 16 20:07:34 2016 +0000 @@ -0,0 +1,1 @@ +LSM6DS3#46630122dec9
--- a/LSM9DS1.lib Mon Oct 19 16:52:59 2015 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -https://developer.mbed.org/users/beanmachine44/code/LSM9DS1/#0e76f237c23d
--- a/main.cpp Mon Oct 19 16:52:59 2015 +0000
+++ b/main.cpp Thu Jun 16 20:07:34 2016 +0000
@@ -1,17 +1,17 @@
-// LSM9DS91 Demo
+// LSM6DS3 Demo
#include "mbed.h"
-#include "LSM9DS1.h"
+#include "LSM6DS3.h"
// refresh time. set to 500 for part 2 and 50 for part 4
#define REFRESH_TIME_MS 1000
// Verify that the pin assignments below match your breadboard
-LSM9DS1 imu(p9, p10);
+LSM6DS3 imu(p30, p7);
-Serial pc(USBTX, USBRX);
+Serial pc(p9, p11);
-//Init Serial port and LSM9DS1 chip
+//Init Serial port and LSM6DS3 chip
void setup()
{
// Use the begin() function to initialize the LSM9DS0 library.
@@ -19,29 +19,33 @@
uint16_t status = imu.begin();
//Make sure communication is working
- pc.printf("LSM9DS1 WHO_AM_I's returned: 0x%X\r\n", status);
- pc.printf("Should be 0x683D\r\n");
+ pc.printf("LSM6DS3 WHO_AM_I's returned: 0x%X\r\n", status);
+ pc.printf("Should be 0x69\r\n");
}
int main()
{
setup(); //Setup sensor and Serial
- pc.printf("------ LSM9DS1 Demo -----------\r\n");
+ pc.printf("\r\n------ LSM6DS3 Demo -----------\r\n");
while (true)
{
+ imu.readTemp();
+ pc.printf("Temp:\r\n");
+ pc.printf("TC: %2f\r\n", imu.temperature_c);
+ pc.printf("TF: %2f\r\n", imu.temperature_f);
imu.readAccel();
-
- pc.printf("A: %2f, %2f, %2f\r\n", imu.ax, imu.ay, imu.az);
+ pc.printf("Accel:\r\n");
+ pc.printf("AX: %2f\r\n", imu.ax);
+ pc.printf("AY: %2f\r\n", imu.ay);
+ pc.printf("AZ: %2f\r\n", imu.az);
imu.readGyro();
-
- pc.printf("G: %2f, %2f, %2f\r\n", imu.gx, imu.gy, imu.gz);
-
- imu.readMag();
-
- pc.printf("M: %2f, %2f, %2f\r\n\r\n", imu.mx, imu.my, imu.mz);
+ pc.printf("Gyro:\r\n");
+ pc.printf("GX: %2f\r\n", imu.gx);
+ pc.printf("GY: %2f\r\n", imu.gy);
+ pc.printf("GZ: %2f\r\n\r\n", imu.gz);
wait_ms(REFRESH_TIME_MS);
}
--- a/mbed.bld Mon Oct 19 16:52:59 2015 +0000 +++ b/mbed.bld Thu Jun 16 20:07:34 2016 +0000 @@ -1,1 +1,1 @@ -http://mbed.org/users/mbed_official/code/mbed/builds/34e6b704fe68 \ No newline at end of file +http://mbed.org/users/mbed_official/code/mbed/builds/6c34061e7c34 \ No newline at end of file
