Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Revision 3:d04241d03c10, committed 2019-01-26
- Comitter:
- moham
- Date:
- Sat Jan 26 15:53:17 2019 +0000
- Parent:
- 2:4cc7f42f94c1
- Commit message:
- ruche connectee;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4cc7f42f94c1 -r d04241d03c10 main.cpp
--- a/main.cpp Fri May 25 19:57:58 2018 +0000
+++ b/main.cpp Sat Jan 26 15:53:17 2019 +0000
@@ -11,8 +11,8 @@
int dateRef = 90318;
Serial pc(USBTX,USBRX);
-Serial gps(p9, p10);
-TextLCD lcd(p11, p12, p15, p16, p29, p30); // rs, e, d4, d5, d6, d7
+Serial gps(D1, D0);
+//TextLCD lcd(p11, p12, p15, p16, p29, p30); // rs, e, d4, d5, d6, d7
void Init()
{
@@ -26,15 +26,15 @@
char nortSouth, eastWest, status;
int date,fq, nst; // fix quality, Number of satellites being tracked, 3D fix
float latitude, longitude, timefix, speed,altitude;
-
+
if(strncmp(cDataBuffer,"$GPRMC", 6) == 0)
{
sscanf(cDataBuffer, "$GPRMC,%f,%c,%f,%c,%f,%c,%f,,%d", &timefix, &status, &latitude, &nortSouth, &longitude, &eastWest, &speed, &date);
if (latitude !=0)
- *lat = latitude;
+ *lat = latitude*0.01;
if (longitude != 0)
- *lon = longitude;
+ *lon = longitude*0.01;
*tmf = timefix;
@@ -56,10 +56,10 @@
sscanf(cDataBuffer, "$GPGLL,%f,%c,%f,%c,%f", &latitude, &nortSouth, &longitude, &eastWest, &timefix);
//pc.printf("%s",cDataBuffer);
if (latitude !=0)
- *lat = latitude;
+ *lat = latitude * 0.01;
if (longitude != 0)
- *lon = longitude;
+ *lon = longitude * 0.01;
*tmf = timefix;
*spd = speed;
@@ -76,10 +76,10 @@
{
sscanf(cDataBuffer, "$GPGGA,%f,%f,%c,%f,%c,%d,%d,%*f,%f", &timefix, &latitude, &nortSouth, &longitude, &eastWest, &fq, &nst, &altitude);
if (latitude !=0)
- *lat = latitude;
+ *lat = latitude * 0.01;
if (longitude != 0)
- *lon = longitude;
+ *lon = longitude * 0.01;
//*alt = altitude;
*tmf = timefix;
@@ -125,16 +125,16 @@
if (gpsACK == 0)
{
- lcd.printf("HORA:%d\n",(int)timefix);
- lcd.printf("DATA:%d\n",date);
- pc.printf("GPRMC Fix: %f, Status: %c, Latitude: %f %c, Longitude: %f %c, Speed: %f, Date: %d\n", timefix, status, latitude, ns, longitude, ew, speed, date);
- wait(.2);
- /* lcd.cls();
- lcd.printf("LATITUDE:\n%f %c ",latitude,ns);
+ //pc.printf("HORA:%d\n",(int)timefix);
+ //pc.printf("DATA:%d\n",date);
+ pc.printf(" Latitude: %f , Longitude: %f \r\n", latitude, longitude);
+ wait(3);
+ // lcd.cls();
+ pc.printf("LATITUDE:\n%f %c \r\n",latitude,ns);
wait(2);
- lcd.cls();
- lcd.printf("LONGITUDE:\n%f %c ",longitude,ew);
- wait(2);*/
+ //lcd.cls();
+ pc.printf("LONGITUDE:\n%f %c \r\n",longitude,ew);
+ wait(2);
}