GPS Tweeter program that tweets the device's GPS location every 5 minutes.
Dependencies: EthernetNetIf HTTPClient mbed
Fork of TwitterExample by
GPS.h@6:a5d8918748fa, 2013-10-16 (annotated)
- Committer:
- 4180skrw
- Date:
- Wed Oct 16 20:42:20 2013 +0000
- Revision:
- 6:a5d8918748fa
- Parent:
- 4:2d5b7c5b995e
fixed
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
4180skrw | 4:2d5b7c5b995e | 1 | /* mbed EM-406 GPS Module Library |
4180skrw | 4:2d5b7c5b995e | 2 | * Copyright (c) 2008-2010, sford |
4180skrw | 4:2d5b7c5b995e | 3 | * |
4180skrw | 4:2d5b7c5b995e | 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
4180skrw | 4:2d5b7c5b995e | 5 | * of this software and associated documentation files (the "Software"), to deal |
4180skrw | 4:2d5b7c5b995e | 6 | * in the Software without restriction, including without limitation the rights |
4180skrw | 4:2d5b7c5b995e | 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
4180skrw | 4:2d5b7c5b995e | 8 | * copies of the Software, and to permit persons to whom the Software is |
4180skrw | 4:2d5b7c5b995e | 9 | * furnished to do so, subject to the following conditions: |
4180skrw | 4:2d5b7c5b995e | 10 | * |
4180skrw | 4:2d5b7c5b995e | 11 | * The above copyright notice and this permission notice shall be included in |
4180skrw | 4:2d5b7c5b995e | 12 | * all copies or substantial portions of the Software. |
4180skrw | 4:2d5b7c5b995e | 13 | * |
4180skrw | 4:2d5b7c5b995e | 14 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
4180skrw | 4:2d5b7c5b995e | 15 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
4180skrw | 4:2d5b7c5b995e | 16 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
4180skrw | 4:2d5b7c5b995e | 17 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
4180skrw | 4:2d5b7c5b995e | 18 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
4180skrw | 4:2d5b7c5b995e | 19 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
4180skrw | 4:2d5b7c5b995e | 20 | * THE SOFTWARE. |
4180skrw | 4:2d5b7c5b995e | 21 | */ |
4180skrw | 4:2d5b7c5b995e | 22 | |
4180skrw | 4:2d5b7c5b995e | 23 | #include "mbed.h" |
4180skrw | 4:2d5b7c5b995e | 24 | |
4180skrw | 4:2d5b7c5b995e | 25 | #ifndef MBED_GPS_H |
4180skrw | 4:2d5b7c5b995e | 26 | #define MBED_GPS_H |
4180skrw | 4:2d5b7c5b995e | 27 | |
4180skrw | 4:2d5b7c5b995e | 28 | /** A GPS interface for reading from a Globalsat EM-406 GPS Module */ |
4180skrw | 4:2d5b7c5b995e | 29 | class GPS { |
4180skrw | 4:2d5b7c5b995e | 30 | public: |
4180skrw | 4:2d5b7c5b995e | 31 | |
4180skrw | 4:2d5b7c5b995e | 32 | /** Create the GPS interface, connected to the specified serial port |
4180skrw | 4:2d5b7c5b995e | 33 | */ |
4180skrw | 4:2d5b7c5b995e | 34 | GPS(PinName tx, PinName rx); |
4180skrw | 4:2d5b7c5b995e | 35 | |
4180skrw | 4:2d5b7c5b995e | 36 | /** Sample the incoming GPS data, returning whether there is a lock |
4180skrw | 4:2d5b7c5b995e | 37 | * |
4180skrw | 4:2d5b7c5b995e | 38 | * @return 1 if there was a lock when the sample was taken (and therefore .longitude and .latitude are valid), else 0 |
4180skrw | 4:2d5b7c5b995e | 39 | */ |
4180skrw | 4:2d5b7c5b995e | 40 | int sample(); |
4180skrw | 4:2d5b7c5b995e | 41 | |
4180skrw | 4:2d5b7c5b995e | 42 | /** The longitude (call sample() to set) */ |
4180skrw | 4:2d5b7c5b995e | 43 | float longitude; |
4180skrw | 4:2d5b7c5b995e | 44 | |
4180skrw | 4:2d5b7c5b995e | 45 | /** The latitude (call sample() to set) */ |
4180skrw | 4:2d5b7c5b995e | 46 | float latitude; |
4180skrw | 4:2d5b7c5b995e | 47 | |
4180skrw | 4:2d5b7c5b995e | 48 | private: |
4180skrw | 4:2d5b7c5b995e | 49 | float trunc(float v); |
4180skrw | 4:2d5b7c5b995e | 50 | void getline(); |
4180skrw | 4:2d5b7c5b995e | 51 | |
4180skrw | 4:2d5b7c5b995e | 52 | Serial _gps; |
4180skrw | 4:2d5b7c5b995e | 53 | char msg[256]; |
4180skrw | 4:2d5b7c5b995e | 54 | |
4180skrw | 4:2d5b7c5b995e | 55 | }; |
4180skrw | 4:2d5b7c5b995e | 56 | |
4180skrw | 4:2d5b7c5b995e | 57 | #endif |