Im trying to build a speedo Head up Display for my motorcycle helmet. Ive worked out the physical side using a convex lens from an old pair of binoculars and some semi reflective film.
Ive managed to get an Oled screen to work using the example software and a GPS unit using its example script.
My problem is now taking the data for speed put out by the GPS and then displaying that on the Oled. I started to try and copy and paste from the respective example scripts what I would need to do this but I’m getting bogged down. Can anyone help.
This is the scripting I’ve managed so far.
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#include “TinyGPS++.h”
#include “SoftwareSerial.h” // for testing purposes
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 32 // OLED display height, in pixels
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
#define OLED_RESET 4 // Reset pin # (or -1 if sharing Arduino reset pin)
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
display.clearDisplay
display.gpsspeeddata
{
while(serial_connection.available())//While there are characters to come from the GPS
{
gps.encode(serial_connection.read());//This feeds the serial NMEA data into the library one char at a time
}
if(gps.location.isUpdated())//This will pretty much be fired all the time anyway but will at least reduce it to only after a package of NMEA data comes in
{
Serial.println(“Speed MPH:”);// This is not code i know that but its essentially what I want to know how to do.
Serial.println(gps.speed.mph());
}
Any help appreciated. Im aware the above is a mess. I mostly was just cutting out of the example scripts what was clearly not necessary for my aim.
Am i right in thinking though that my project does require a very simple extraction of data (speed), then transfer of that data to display? Once i have that basically done i can fiddle around with things like the size of the display font, colour etc.