Book Image

Arduino Wearable Projects

Book Image

Arduino Wearable Projects

Overview of this book

Table of Contents (16 chapters)

The final sketch


By now you should have your case ready and all your components soldered, so it is time to add the final sketch to the FLORA board. The following sketch is basically a combination of the GPS and OLED sketches we tried out before. Once you are done, you can upload it to the board. If everything is correct, the information should be displayed on the screen:

#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
Adafruit_GPS GPS(&Serial1);

#define OLED_RESET 6
Adafruit_SSD1306 display(OLED_RESET);

void setup()
{
Serial.begin(115200);
  display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
  // Clear the buffer.
  display.clearDisplay();
  Serial.println("Testing GPS");

  // 9600 NMEA is the default baud rate for MTK3339
  GPS.begin(9600);

  // Set the update rate of the GPS
  GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);

  delay(1000);
}

uint32_t timer = millis...