ûfiyuiui
Dependencies: gpsmpu6050 GP-20U7 gps_event_vitesse mbed
Revision 0:2caf6c1eb7ad, committed 2016-06-06
- Comitter:
- alex7095
- Date:
- Mon Jun 06 07:00:42 2016 +0000
- Commit message:
- po
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/MPU6050.lib Mon Jun 06 07:00:42 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/alex7095/code/gpsmpu6050/#f8c8c5bbb563
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gps.lib Mon Jun 06 07:00:42 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/wschon/code/GP-20U7/#720966cb4824
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gps_event_vitesse.lib Mon Jun 06 07:00:42 2016 +0000 @@ -0,0 +1,1 @@ +https://developer.mbed.org/users/schnf30/code/gps_event_vitesse/#dfc738d8aba1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Jun 06 07:00:42 2016 +0000 @@ -0,0 +1,60 @@ +#include "mbed.h" +#include "MPU6050.h" +#include "gps_event_vitesse.h" + + + +#define GPSRX p14 +#define GPSTX p13 +Gps gps(GPSTX,GPSRX); + +#define MPU6050_ACCELERO_RANGE_2G 0 +MPU6050 mpu(p28, p27); +Ticker timeracc; +int flipacc = 1; + +Serial pc(USBTX, USBRX); + +void attimeacc() +{ + flipacc = !flipacc; +} + +int main () +{ + pc.baud(9600); + int accdata[3]; + float x; + float y; + float z; + timeracc.attach(&attimeacc, 0.1); + + //wait(0.1); + + if (mpu.testConnection()) + pc.printf("MPU connection succeeded\n\r"); + else + pc.printf("MPU connection failed\n\r"); + + + while(1) { + if (flipacc==0) { + mpu.getAcceleroRaw(accdata); + x= (float)((accdata[0])/16384.0f); + y= (float)((accdata[1])/16384.0f); + z= (float)((accdata[2])/16384.0f); + + pc.printf("Accelero data: X: %f - Y: %f - Z: %f\n\r", x, y, z); + flipacc=1; + } + if (gps.sample()) { + pc.printf("Trame $GPGGA recue "); + + if (gps.lock()) + + pc.printf("Gps Loocked,%d,%06.0lf,%d,%f,%c,%lf,%c,%.0lf,%.0lf,$\r\n",gps.nbsattelite(),gps.time(),gps.lock(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),gps.vitesse_gps()); + else + pc.printf("Gps UnLoocked,%d,%06.0lf,%d,%lf,%c,%lf,%c,%s,%s,$\r\n",gps.nbsattelite(),gps.time(),gps.lock(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),"--"); + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Jun 06 07:00:42 2016 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/aae6fcc7d9bb \ No newline at end of file