Yay, it works!

This commit is contained in:
Starbeamrainbowlabs 2019-06-13 15:10:12 +01:00
parent 7dbfd5807b
commit 4d394b1978
4 changed files with 8 additions and 7 deletions

View file

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

View file

@ -16,7 +16,7 @@ TinyGPSLocation gps_location() {
// We WILL discover our location - if it's the last thing we do! // We WILL discover our location - if it's the last thing we do!
while(true) { while(true) {
if(millis() > 5000 && gps.charsProcessed() < 10) { 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); } while(true) { delay(1); }
} }
@ -31,7 +31,7 @@ TinyGPSLocation gps_location() {
// If we haven't acquired a lock yet, go around again // 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) // 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("."); Serial.print(".");
delay(100); delay(100);
continue; continue;

View file

@ -10,6 +10,7 @@
void setup() { void setup() {
Serial.begin(BAUD_PC); Serial.begin(BAUD_PC);
Serial.println("[main] Beginning collection sequence.");
random_begin(); random_begin();
@ -18,7 +19,7 @@ void setup() {
TinyGPSLocation loc = gps_location(); TinyGPSLocation loc = gps_location();
gps_end(); 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(); uint32_t id = random_get();

View file

@ -16,11 +16,11 @@
// The *TX* gin of the GPS device. // 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. // 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. // The *RX* pin on the GPS device.
// This is swapped because where the GPs device is receiving, we aresending and vice versa. // 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. // 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. // 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. // 9600 is the correct speed for a NEO-6M.
#define BAUD_GPS 9600 #define BAUD_GPS 9600