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.
Dependencies: TimerExtended TinyGPS mbed
Revision 0:cfd5cc72b38c, committed 2014-12-08
- Comitter:
- morimoriYNCT
- Date:
- Mon Dec 08 12:30:18 2014 +0000
- Commit message:
- GPS???????????????????????
Changed in this revision
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TimerExtended.lib Mon Dec 08 12:30:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/morimoriYNCT/code/TimerExtended/#2441ccdcd627
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TinyGPS.lib Mon Dec 08 12:30:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/shimniok/code/TinyGPS/#f522b8bdf987
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon Dec 08 12:30:18 2014 +0000
@@ -0,0 +1,70 @@
+/**********************************
+check: OK, ublox 5T
+**********************************/
+#include "mbed.h"
+#include "TinyGPS.h"
+#include "TimerExtended.h"
+
+TinyGPS gpsr;
+
+// serial
+Serial serial_gps(p9, p10); // tx, rx
+Serial serial_pc(USBTX, USBRX); // tx, rx
+
+Timer timer;
+TimerExtended timer2;
+TimerExtended timer3;
+
+void setup()
+{
+ timer.start();
+ timer2.start();
+
+ serial_gps.baud(9600);
+ serial_pc.baud(115200);
+
+ serial_pc.printf("hello\n");
+ wait(3.0);
+
+ timer3.start();
+}
+
+void loop()
+{
+ if(serial_gps.readable())
+ {
+ //serial_pc.printf("hoge\n");
+ char c = serial_gps.getc();
+ //serial_pc.putc(c);
+ bool gps_avairable = gpsr.encode(c);
+ if(gps_avairable)
+ {
+ //serial_pc.printf("fuga\n");
+ double lat, lon;
+ unsigned long age;
+ (void)gpsr.f_get_position(&lat, &lon, &age);
+
+ int year;
+ byte month, day, hour, minute, second;
+ (void)gpsr.crack_datetime(&year, &month, &day, &hour, &minute, &second);
+
+ double t = (double)timer.read_ms() / 1000.0;
+ serial_pc.printf("%f, ", t);
+ double t2 = (double)timer2.read_ms() / 1000.0;
+ serial_pc.printf("%f, ", t2);
+ double t3 = (double)timer3.read_ms() / 1000.0;
+ serial_pc.printf("%f, ", t3);
+ serial_pc.printf("%d-%02d-%02d %02d:%02d:%02d, ", year, month, day, hour, minute, second);
+ serial_pc.printf("%f, %f\n", lat, lon);
+ }
+ }
+}
+
+int main() {
+ setup();
+
+ while(1)
+ {
+ loop();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed.bld Mon Dec 08 12:30:18 2014 +0000 @@ -0,0 +1,1 @@ +http://mbed.org/users/mbed_official/code/mbed/builds/04dd9b1680ae \ No newline at end of file