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 PulseSensor2 SCP1000 mbed-rtos 4DGL-uLCD-SE LSM9DS1_Library_cal PinDetect FatFileSystemCpp GP-20U7
main.cpp
- Committer:
- Richard_Xiong
- Date:
- 2020-03-25
- Revision:
- 7:fb47593628be
- Parent:
- 6:29ccbdd09706
- Child:
- 20:adb9e6e1ad22
File content as of revision 7:fb47593628be:
#include "mbed.h"
#include "LSM9DS1.h"
#include "uLCD_4DGL.h"
uLCD_4DGL uLCD(p28, p27, p30);
LSM9DS1 my_imu(p9, p10, 0xD6, 0x3C);
int Steps;
int main() {
// set up the display
uLCD.display_control(PORTRAIT);
uLCD.baudrate(BAUD_3000000);
uLCD.background_color(BLACK);
uLCD.cls();
wait(0.5);
//set up the imu
my_imu.begin();
if (!my_imu.begin()) {
uLCD.printf("Failed to communicate with LSM9DS1.\n");
}
my_imu.calibrate();
while (1) {
//reading the acceleration/Mag/Gyro data information from the imu
my_imu.readAccel();
my_imu.readMag();
my_imu.readGyro();
// print the information to the LCD display
uLCD.printf("Your steps right now is %d",steps);
uLCD.printf("gyro: %d %d %d\n\r", my_imu.gx, my_imu.gy, my_imu.gz);
uLCD.printf("accel: %d %d %d\n\r", my_imu.ax, my_imu.ay, my_imu.az);
uLCD.printf("mag: %d %d %d\n\n\r", my_imu.mx, my_imu.my, my_imu.mz);
}
}

