Riccardo Arciulo / Mbed 2 deprecated ACCGYR2

Dependencies:   LSM6DSL mbed

Files at this revision

API Documentation at this revision

Comitter:
RichieHard
Date:
Sat Jan 27 13:56:33 2018 +0000
Commit message:
no comments

Changed in this revision

LSM6DSL.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /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