Skip to content

Instantly share code, notes, and snippets.

@vlrmprjct
Last active October 17, 2021 14:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vlrmprjct/e5c9f9dc97fe3d909098826f3c03ab34 to your computer and use it in GitHub Desktop.
Save vlrmprjct/e5c9f9dc97fe3d909098826f3c03ab34 to your computer and use it in GitHub Desktop.
GPS Speed Arduino Pro Micro #gps #arduino #promicro #attiny1634 #rx #tx #speedometer
// GPS Speedometer
// Copyright (c) 2021 Thomas Meschke
//
// MIT License
// https://opensource.org/licenses/mit-license.php
//
// Put the GPS Module ( NEO-6M-x ) on the following pins:
// TX: Arduino Pro Micro / ATTINY 1634 => RX Pin
// RX: Arduino Pro Micro / ATTINY 1634 => TX Pin
//
// Important note:
// By using an ATTINY 1634 use Serial() instead of Serial1() !
//
// No SoftSerial is needed !
#include <TinyGPS++.h>;
TinyGPSPlus gps;
unsigned long last = 0UL;
void setup() {
// SERIAL CONNECTION ON DEVICE TX + RX
Serial1.begin(9600);
}
void loop() {
while (Serial1.available()) {
gps.encode(Serial1.read());
if (millis() - last > 500) {
// DO SOMETHING WITH gps.speed.kmph() HERE
if (gps.charsProcessed() < 10) {
// SOMETHING WENT WRONG
}
last = millis();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment