schneider françois
/
Test_gps_sample
OK
Diff: main.cpp
- Revision:
- 0:5cddc7863ae6
- Child:
- 1:828c32336aa2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Sun May 01 19:43:44 2016 +0000 @@ -0,0 +1,25 @@ +#include "mbed.h" +#include "Sf_gps.h" + +Gps gps(USBTX, USBRX); + +#define gps_event // pour utiliser en mode event. + +#ifdef gps_event +void Gps_attache() { + gps.receive(); + } +#endif + +int main() { + gps.printf("Hello, I'm Ok\r\n"); + #ifdef gps_event + gps.attach(&Gps_attache, Serial::RxIrq); + #endif + while(1) { + #ifndef gps_event + gps.receive(); + #endif + if (gps.gps_data_ok()) gps.printf("Receive %f, %f, %c ,%f ,%c ,%d, %d\r\n",gps.time(),gps.latitude(),gps.ns(),gps.longitude(),gps.ew(),gps.lock(),gps.nbsattelite()); + } + }