Add platform - Wizwiki-W7500
Fork of GPS_HelloWorld by
알아두기
- GPS 시간정보(수신데이터분석) : https://socatelier.wordpress.com/2015/07/27/received-data-of-gps/
- Adafruit GPS : https://socatelier.wordpress.com/2015/07/27/adafruit-gps/
사용제품 및 프로그램
- WIZwiki-W7500 : http://shop.wiznet.co.kr/front/contents/main/main.asp
- Adafruit GPS : https://learn.adafruit.com/adafruit-ultimate-gps
- Jumper line
- mbed Web compile :http://mbed.org/
하드웨어 구성
아래의 그림과 같이 연결하면 된다.
WIZwiki-W7500 | GPS |
3.3V | Vin |
GND | GND |
D0 | TX |
D1 | RX |
소프트웨어 구성
Link : https://developer.mbed.org/users/eunkyoungkim/code/GPS_OLED_HelloWorld
아래는 mbed Web compiler에서 사용한 Source Code이다. 위의 링크로 가면 GPS의 Library도 같이 볼수 있다.
include the mbed library with this snippet
/* Example showing how to hook up to different GPS modules (GlobalSat EM406a and Adafruit Ultimate GPSv3) * to emulated serial ports at different speeds */ #include "mbed.h" #include "GPS.h" #ifdef TARGET_WIZwiki_W7500 GPS gpsAda(D1, D0, 9600); #else GPS gpsAda(P0_12, P0_15, 9600); GPS gpsSpark(P0_4, P0_0, 4800); #endif Serial pc(USBTX, USBRX); int main() { char ch[] = {"Adafruit"}; char ch1[] = {"Sparkfun Breakout"}; while (1) { #ifndef TARGET_WIZwiki_W7500 if(gpsSpark.sample()) { pc.printf("set %s\t%f\t%f\t%f\t%f\t%f\n\r", ch1, gpsSpark.longitude, gpsSpark.latitude, gpsSpark.alt, gpsSpark.geoid, gpsSpark.time); } #endif if(gpsAda.sample()) { pc.printf("set %s\t%f\t%f\t%f\t%f\t%f\r\n", ch, gpsAda.longitude, gpsAda.latitude, gpsAda.alt, gpsAda.geoid, gpsAda.time); } } }
결과
현재 내가 있는 위치의 GPS정보이다.
아래의 그림은 구글 지도에서의 GPS정보이다.
표로 정리하면 아래와 같다.
Terminal | google map | |
latitude(위도) | 37.378540 | 37.378633 |
longitude(경도) | 127.112206 | 127.113032 |
main.cpp@6:9939588707f3, 2015-07-27 (annotated)
- Committer:
- eunkyoungkim
- Date:
- Mon Jul 27 04:56:48 2015 +0000
- Revision:
- 6:9939588707f3
- Parent:
- 4:8348c0e2f109
wrong calculation of longitude
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
8fromPi | 1:bf6b98a2e480 | 1 | /* Example showing how to hook up to different GPS modules (GlobalSat EM406a and Adafruit Ultimate GPSv3) |
8fromPi | 1:bf6b98a2e480 | 2 | * to emulated serial ports at different speeds */ |
simon | 0:6b7345059afe | 3 | #include "mbed.h" |
simon | 0:6b7345059afe | 4 | #include "GPS.h" |
simon | 0:6b7345059afe | 5 | |
eunkyoungkim | 3:065f826fcab5 | 6 | |
eunkyoungkim | 2:9077ee09f54e | 7 | #ifdef TARGET_WIZwiki_W7500 |
eunkyoungkim | 2:9077ee09f54e | 8 | GPS gpsAda(D1, D0, 9600); |
eunkyoungkim | 2:9077ee09f54e | 9 | #else |
eunkyoungkim | 2:9077ee09f54e | 10 | GPS gpsAda(P0_12, P0_15, 9600); |
eunkyoungkim | 3:065f826fcab5 | 11 | GPS gpsSpark(P0_4, P0_0, 4800); |
eunkyoungkim | 2:9077ee09f54e | 12 | #endif |
8fromPi | 1:bf6b98a2e480 | 13 | |
simon | 0:6b7345059afe | 14 | Serial pc(USBTX, USBRX); |
simon | 0:6b7345059afe | 15 | |
simon | 0:6b7345059afe | 16 | int main() { |
eunkyoungkim | 4:8348c0e2f109 | 17 | char ch[] = {"Adafruit"}; |
eunkyoungkim | 4:8348c0e2f109 | 18 | char ch1[] = {"Sparkfun Breakout"}; |
eunkyoungkim | 4:8348c0e2f109 | 19 | |
8fromPi | 1:bf6b98a2e480 | 20 | while (1) { |
eunkyoungkim | 3:065f826fcab5 | 21 | #ifndef TARGET_WIZwiki_W7500 |
8fromPi | 1:bf6b98a2e480 | 22 | if(gpsSpark.sample()) { |
eunkyoungkim | 4:8348c0e2f109 | 23 | pc.printf("set %s\t%f\t%f\t%f\t%f\t%f\n\r", ch1, gpsSpark.longitude, gpsSpark.latitude, gpsSpark.alt, gpsSpark.geoid, gpsSpark.time); |
8fromPi | 1:bf6b98a2e480 | 24 | } |
eunkyoungkim | 3:065f826fcab5 | 25 | #endif |
8fromPi | 1:bf6b98a2e480 | 26 | if(gpsAda.sample()) { |
eunkyoungkim | 4:8348c0e2f109 | 27 | pc.printf("set %s\t%f\t%f\t%f\t%f\t%f\r\n", ch, gpsAda.longitude, gpsAda.latitude, gpsAda.alt, gpsAda.geoid, gpsAda.time); |
simon | 0:6b7345059afe | 28 | } |
8fromPi | 1:bf6b98a2e480 | 29 | |
simon | 0:6b7345059afe | 30 | } |
8fromPi | 1:bf6b98a2e480 | 31 | |
8fromPi | 1:bf6b98a2e480 | 32 | } |