apenas pega nos dados recebidos do simulador de GPS na porta uart2 e envia processada para o pc. A FUNCIONAR!

Dependencies:   SerialGPS mbed

Fork of Sparkfun_GPS_Shield by Shields

Committer:
Charrua
Date:
Wed Jul 12 10:58:32 2017 +0000
Revision:
2:17b641282f3f
Parent:
1:6bba24a04008
teste

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 1:6bba24a04008 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
screamer 1:6bba24a04008 2 *
screamer 1:6bba24a04008 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
screamer 1:6bba24a04008 4 * and associated documentation files (the "Software"), to deal in the Software without
screamer 1:6bba24a04008 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
screamer 1:6bba24a04008 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
screamer 1:6bba24a04008 7 * Software is furnished to do so, subject to the following conditions:
screamer 1:6bba24a04008 8 *
screamer 1:6bba24a04008 9 * The above copyright notice and this permission notice shall be included in all copies or
screamer 1:6bba24a04008 10 * substantial portions of the Software.
screamer 1:6bba24a04008 11 *
screamer 1:6bba24a04008 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
screamer 1:6bba24a04008 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
screamer 1:6bba24a04008 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
screamer 1:6bba24a04008 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
screamer 1:6bba24a04008 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
screamer 1:6bba24a04008 17 */
screamer 1:6bba24a04008 18
screamer 0:2465168eb818 19 #include "mbed.h"
screamer 0:2465168eb818 20 #include "SerialGPS.h"
screamer 0:2465168eb818 21
screamer 0:2465168eb818 22 /** On many platforms USBTX/USBRX overlap with serial on D1/D0 pins and enabling the below will interrupt the communication.
screamer 0:2465168eb818 23 * You can use an LCD display to print the values or store them on an SD card etc.
screamer 0:2465168eb818 24 */
Charrua 2:17b641282f3f 25 Serial pc(USBTX, USBRX); Porta série da ficha SDA da placa, usa o putty ou outro terminal tipo teraterm ou mobaxterm com a porta série que o pc configura para mbed
screamer 0:2465168eb818 26
screamer 0:2465168eb818 27 /**
screamer 0:2465168eb818 28 * D1 - TX pin (RX on the GPS module side)
screamer 0:2465168eb818 29 * D0 - RX pin (TX on the GPS module side)
screamer 0:2465168eb818 30 * 4800 - GPS baud rate
screamer 0:2465168eb818 31 */
Charrua 2:17b641282f3f 32 SerialGPS gps(PTE22, PTE23, 9600); // PTE23 - liga no Tx do conversor e PTE23 no Rx do conversor, atenção à porta série que o teu pc atribui ao conversor
screamer 0:2465168eb818 33
screamer 0:2465168eb818 34 DigitalOut myled(LED1);
screamer 0:2465168eb818 35
Charrua 2:17b641282f3f 36 main(void) {
Charrua 2:17b641282f3f 37 int erro;
screamer 0:2465168eb818 38 while (1) {
Charrua 2:17b641282f3f 39 pc.printf("Hello World!\n\r");
Charrua 2:17b641282f3f 40
Charrua 2:17b641282f3f 41 myled = myled ? 0 : 1;
screamer 0:2465168eb818 42 if (gps.sample()) {
Charrua 2:17b641282f3f 43 pc.printf("sats %d, long %f, lat %f, alt %f, geoid %f, time %f\n\r", gps.sats, gps.longitude, gps.latitude, gps.alt, gps.geoid, gps.time);
screamer 0:2465168eb818 44 }
Charrua 2:17b641282f3f 45 wait(1);
Charrua 2:17b641282f3f 46
screamer 0:2465168eb818 47 }
screamer 0:2465168eb818 48 }