OLED will display speed, but at a very slow update speed, perhaps every 5-7 seconds.
I'm very new to this so be gentle, i'm well aware that other GPS scripts i have seen are much larger and more complicated than mine, i'm just not at a stage yet where i under stand anything but the most basic programming.
GPS- UBlox 6m is TX is connected to D4, RX to D3.
OLED- is to SDA-A4 and CLK-A5
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include <TinyGPS++.h>
#include <SoftwareSerial.h>
static const int RXPin = 4, TXPin = 3;
static const uint32_t GPSBaud = 9600; //was 4800
// The TinyGPS++ object
TinyGPSPlus gps;
// The serial connection to the GPS device
SoftwareSerial ss(RXPin, TXPin);
#define OLED_RESET 7
Adafruit_SSD1306 display(OLED_RESET);
String speedinkm;
int f=0;
void setup()
{
display.begin(SSD1306_SWITCHCAPVCC, 0x3c);
display.clearDisplay();
Serial.begin(9600);
ss.begin(GPSBaud);
}
void loop()
{
f = round( gps.speed.kmph());
speedinkm = String(f);
Serial.print(speedinkm);
// This sketch displays information every time a new sentence is correctly encoded.
while (ss.available() > 0)
if (gps.encode(ss.read()))
// displayInfo();
if (millis() > 5000 && gps.charsProcessed() < 10)
Serial.println(F("Speed"));
Serial.println(gps.speed.kmph(), 6);
Serial.print(F(","));
Serial.println(F("Number of sats"));
Serial.println(gps.satellites.value(), 6);
Serial.println(F("GPS Lat"));
Serial.println(gps.location.lat(), 6);
{
display.setTextSize(3);
display.setTextColor(WHITE);
display.setCursor(0,0);
display.println(speedinkm);
display.display();
}
}