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.
main.cpp
00001 #include "mbed.h" 00002 #include "LSM6DSLSensor.h" 00003 00004 int main() { 00005 uint8_t id; 00006 int32_t axes[3]; 00007 DevI2C *dev_i2c = new DevI2C(D14, D15); 00008 LSM6DSLSensor *acc_gyro = new LSM6DSLSensor(dev_i2c, LSM6DSL_ACC_GYRO_I2C_ADDRESS_LOW, A2, A3); 00009 00010 acc_gyro->enable_x(); 00011 acc_gyro->enable_g(); 00012 00013 printf("\r\nLSM6DSL example\r\n"); 00014 00015 acc_gyro->read_id(&id); 00016 printf("LSM6DSL accelerometer & gyroscope = 0x%X\r\n", id); 00017 00018 while(1) { 00019 acc_gyro->get_x_axes(axes); 00020 printf("LSM6DSL [acc/mg]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); 00021 00022 acc_gyro->get_g_axes(axes); 00023 printf("LSM6DSL [gyro/mdps]: %6ld, %6ld, %6ld\r\n", axes[0], axes[1], axes[2]); 00024 wait(0.2); // 200 ms 00025 } 00026 }
Generated on Sat Jul 16 2022 20:51:24 by
1.7.2