Yay, it works!

master
Starbeamrainbowlabs 4 years ago
parent 7dbfd5807b
commit 4d394b1978
  1. 4
      iot/GPSTest/GPSTest.ino
  2. 4
      iot/main/gps.cpp
  3. 3
      iot/main/main.ino
  4. 4
      iot/main/settings.h

@ -2,8 +2,8 @@
#include <SoftwareSerial.h>
// NOTE: RX and TX must be swapped with respect to the pin definitions on the NE-6M itself.
#define PIN_GPS_RX 4
#define PIN_GPS_TX 3
#define PIN_GPS_RX 5
#define PIN_GPS_TX 4
#define BAUD_PC 115200
#define BAUD_GPS 9600

@ -16,7 +16,7 @@ TinyGPSLocation gps_location() {
// We WILL discover our location - if it's the last thing we do!
while(true) {
if(millis() > 5000 && gps.charsProcessed() < 10) {
Serial.print(F("\n[error] Failed to initialise GPS device."));
Serial.println(F("\n[error] Failed to initialise GPS device."));
while(true) { delay(1); }
}
@ -31,7 +31,7 @@ TinyGPSLocation gps_location() {
// If we haven't acquired a lock yet, go around again
// Also go around again if the location is the same hasn't yet been updated (GPS devices are strange)
if(!gps.location.isValid() || gps.location.isUpdated()) {
if(!gps.location.isValid()) {
Serial.print(".");
delay(100);
continue;

@ -10,6 +10,7 @@
void setup() {
Serial.begin(BAUD_PC);
Serial.println("[main] Beginning collection sequence.");
random_begin();
@ -18,7 +19,7 @@ void setup() {
TinyGPSLocation loc = gps_location();
gps_end();
Serial.print("[main] Location: ("); Serial.print(loc.lat()); Serial.print(", "); Serial.print(loc.lng()); Serial.println();
Serial.print("[main] Location: ("); Serial.print(loc.lat()); Serial.print(", "); Serial.print(loc.lng()); Serial.println(")");
uint32_t id = random_get();

@ -16,11 +16,11 @@
// The *TX* gin of the GPS device.
// This is swapped because we receive the GPS device's message on our side on the RX pin, and the GPS device transmits messages on the TX.
#define PIN_GPS_RX 4
#define PIN_GPS_RX 5
// The *RX* pin on the GPS device.
// This is swapped because where the GPs device is receiving, we aresending and vice versa.
// The TX / RX here are according to *our* side, not the GPS device's side.
#define PIN_GPS_TX 3
#define PIN_GPS_TX 4
// The speed at which we should talk to the GPS device. Some GPS devices require a certain speed in order to use certain commands, so it's important that you check the datasheets for the device you're using.
// 9600 is the correct speed for a NEO-6M.
#define BAUD_GPS 9600

Loading…
Cancel
Save