Ch4_4. GPS모듈 연결하여 위치좌표 구하기

학습 내용

GlobalSat EM-406 GPS모듈을 mbed에 연결하여 위치좌표를 시리얼통신을 통해 PC에 나타내는 학습을 합니다

/media/uploads/jnesystech/gpsproduct.jpg

배선도 & 회로도

/media/uploads/jnesystech/gpsschematic.png

  • VCC :5v
  • Tx :mbed serial rx (e.g. p10)
  • Rx :mbed serial tx (e.g. p9)
  • GND :0v/GND

배선 사진

/media/uploads/jnesystech/gpsphoto.jpg

코딩

#include "mbed.h"
#include "GPS.h"

Serial pc(USBTX, USBRX);
GPS gps(p9, p10);

int main() {
    while(1) {
        if(gps.sample()) {
            pc.printf("I'm at %f, %f\n", gps.longitude, gps.latitude);
        } else {
            pc.printf("Oh Dear! No lock :(\n");
        }
    }
}

라이브러리

학습 참고


1 comment on Ch4_4. GPS모듈 연결하여 위치좌표 구하기:

13 Mar 2013

include the mbed library with this snippet

#include "mbed.h"
#include "GPS.h"
 
Serial pc(USBTX, USBRX);
GPS gps(p9, p10);
 
int main() {
    while(1) {
        if(gps.sample()) {
            pc.printf("I'm at %f, %f\n", gps.longitude, gps.latitude);
        } else {
            pc.printf("Oh Dear! No lock :(\n");
        }
    }
}
 

I tried this code with a GTPA010 GPS module. Code runs, with no compiling error. But I am getting no output at all. The GPS blinks continuously.

If the GPS couldnt find the NMEA string, according to the code, mbed should atleast say "Oh Dear! No lock :( " in the Tera Term but I dont receive any serial output.

I checked 4800, 9600, 38400 baud rates. No improvements.

Although, I see a strange thing happening. All the Leds in the mbed board starts blinking after 15 - 20 mins.

Please provide suggestions.

- Thanks, Abhilash

Please log in to post comments.