schneider françois
/
Test_gps_sample
OK
main.cpp@0:5cddc7863ae6, 2016-05-01 (annotated)
- Committer:
- schnf30
- Date:
- Sun May 01 19:43:44 2016 +0000
- Revision:
- 0:5cddc7863ae6
- Child:
- 1:828c32336aa2
Programme de d?mo de la librairie SfGps
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
schnf30 | 0:5cddc7863ae6 | 1 | #include "mbed.h" |
schnf30 | 0:5cddc7863ae6 | 2 | #include "Sf_gps.h" |
schnf30 | 0:5cddc7863ae6 | 3 | |
schnf30 | 0:5cddc7863ae6 | 4 | Gps gps(USBTX, USBRX); |
schnf30 | 0:5cddc7863ae6 | 5 | |
schnf30 | 0:5cddc7863ae6 | 6 | #define gps_event // pour utiliser en mode event. |
schnf30 | 0:5cddc7863ae6 | 7 | |
schnf30 | 0:5cddc7863ae6 | 8 | #ifdef gps_event |
schnf30 | 0:5cddc7863ae6 | 9 | void Gps_attache() { |
schnf30 | 0:5cddc7863ae6 | 10 | gps.receive(); |
schnf30 | 0:5cddc7863ae6 | 11 | } |
schnf30 | 0:5cddc7863ae6 | 12 | #endif |
schnf30 | 0:5cddc7863ae6 | 13 | |
schnf30 | 0:5cddc7863ae6 | 14 | int main() { |
schnf30 | 0:5cddc7863ae6 | 15 | gps.printf("Hello, I'm Ok\r\n"); |
schnf30 | 0:5cddc7863ae6 | 16 | #ifdef gps_event |
schnf30 | 0:5cddc7863ae6 | 17 | gps.attach(&Gps_attache, Serial::RxIrq); |
schnf30 | 0:5cddc7863ae6 | 18 | #endif |
schnf30 | 0:5cddc7863ae6 | 19 | while(1) { |
schnf30 | 0:5cddc7863ae6 | 20 | #ifndef gps_event |
schnf30 | 0:5cddc7863ae6 | 21 | gps.receive(); |
schnf30 | 0:5cddc7863ae6 | 22 | #endif |
schnf30 | 0:5cddc7863ae6 | 23 | 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()); |
schnf30 | 0:5cddc7863ae6 | 24 | } |
schnf30 | 0:5cddc7863ae6 | 25 | } |