Skip to content

Instantly share code, notes, and snippets.

@flippyhead
Created July 9, 2015 18:11
Show Gist options
  • Select an option

  • Save flippyhead/8c90a7552c3f618b9161 to your computer and use it in GitHub Desktop.

Select an option

Save flippyhead/8c90a7552c3f618b9161 to your computer and use it in GitHub Desktop.
native _begin();
native do
##include <Adafruit_GPS.h>
SoftwareSerial my_Serial(8, 7);
Adafruit_GPS GPS(&my_Serial);
void begin() {
Serial.begin(9600);
Serial.println("CEU GPS TEST");
GPS.begin(9600);
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_RMCGGA);
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); // 1 Hz update rate
GPS.sendCommand(PGCMD_ANTENNA);
}
end
input (float, float) GPS; // lat, long
_begin();
loop do
_GPS.read();
if _GPS.newNMEAreceived() and _GPS.parse(_GPS.lastNMEA()) then
await 3s;
if _GPS.fix then
async do
emit GPS => (_GPS.latitudeDegrees, _GPS.longitudeDegrees);
end
end
end
end
#include "arduino.ceu"
native do
##include <SoftwareSerial.h>
end
par do
#include "gps3.ceu"
with
loop do
var float latitude, longitude;
(latitude, longitude) = await GPS;
_Serial.println("Location fixed:");
_Serial.print(latitude, 4);
_Serial.println(longitude, 4);
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment