Last active
October 17, 2021 14:59
-
-
Save vlrmprjct/e5c9f9dc97fe3d909098826f3c03ab34 to your computer and use it in GitHub Desktop.
GPS Speed Arduino Pro Micro #gps #arduino #promicro #attiny1634 #rx #tx #speedometer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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