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.
Revision 0:c8f53c487a49, committed 2018-01-27
- Comitter:
- RichieHard
- Date:
- Sat Jan 27 13:56:33 2018 +0000
- Commit message:
- no comments
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/LSM6DSL.lib Sat Jan 27 13:56:33 2018 +0000 @@ -0,0 +1,1 @@ +http://os.mbed.com/teams/ST/code/LSM6DSL/#20ccff7dd652
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Sat Jan 27 13:56:33 2018 +0000
@@ -0,0 +1,26 @@
+#include "mbed.h"
+#include "LSM6DSLSensor.h"
+
+int main() {
+ uint8_t id;
+ int32_t axes[3];
+ DevI2C *dev_i2c = new DevI2C(D14, D15);
+ LSM6DSLSensor *acc_gyro = new LSM6DSLSensor(dev_i2c, LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, A2, A3);
+
+ acc_gyro->enable_x();
+ acc_gyro->enable_g();
+
+ printf("\r\nLSM6DSL example\r\n");
+
+ acc_gyro->read_id(&id);
+ printf("LSM6DSL accelerometer & gyroscope = 0x%X\r\n", id);
+
+ while(1) {
+ acc_gyro->get_x_axes(axes);
+ printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
+
+ acc_gyro->get_g_axes(axes);
+ printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]);
+ wait(0.2); // 200 ms
+ }
+}
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Sat Jan 27 13:56:33 2018 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/e7ca05fa8600 \ No newline at end of file