4180 IMU parts (I2C, uLCD, RS232, USB Serial, SD)
Dependencies: 4DGL-uLCD-SE LSM9DS1_Library_cal SDFileSystem mbed
Diff: main.cpp
- Revision:
- 1:6c4ba07e0c77
- Parent:
- 0:2fd46a8b3964
- Child:
- 2:f17a67920767
--- a/main.cpp Thu Feb 11 22:21:06 2016 +0000 +++ b/main.cpp Thu Feb 11 22:46:43 2016 +0000 @@ -1,5 +1,6 @@ #include "mbed.h" #include "LSM9DS1.h" +#include "uLCD_4DGL.h" #define PI 3.14159 // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate @@ -11,6 +12,7 @@ DigitalIn sel(p21); Serial pc(USBTX, USBRX); Serial device(p13, p14); +uLCD_4DGL uLCD(p27,p28,p30); // serial tx, serial rx, reset pin; // Calculate pitch, roll, and heading. @@ -51,6 +53,13 @@ } +void bubLev(float ax, float ay, float az, float oldx, float oldy){ + + uLCD.filled_circle(63, 63, 40, 0x0000FF); + uLCD.filled_circle(ax/az*40+63, ay/az*40+63, 5, 0xFF00FF); + +} + @@ -60,6 +69,7 @@ //device.format(8N1); LSM9DS1 IMU(p9, p10, 0xD6, 0x3C); sel.mode(PullUp); + uLCD.baudrate(3000000); IMU.begin(); if (!IMU.begin()) { pc.printf("Failed to communicate with LSM9DS1.\n");