 #include <Wire.h>
 #include <Adafruit_Sensor.h>
 #include <Adafruit_HMC5883_U.h>
+#include <Adafruit_GFX.h>
+#include <Adafruit_SharpMem.h>
 
 // any pins can be used
 #define SCK 10

  /* Get a new sensor event */ 
  sensors_event_t event; 
  mag.getEvent(&event);
 
  /* Display the results (magnetic vector values are in micro-Tesla (uT)) */
  Serial.print("X: "); Serial.print(event.magnetic.x); Serial.print("  ");
  Serial.print("Y: "); Serial.print(event.magnetic.y); Serial.print("  ");
  Serial.print("Z: "); Serial.print(event.magnetic.z); Serial.print("  ");Serial.println("uT");

  // Hold the module so that Z is pointing 'up' and you can measure the heading with x&y
  // Calculate heading when the magnetometer is level, then correct for signs of axis.

void loop(void) 
{
  // clear GPS serial buffer to get new data
  // while(Serial1.available()) {
  //   Serial1.readln();
  // }
  // delay(10);

  // // get GPS location
  // char GPS[100];
  // while (Serial1.available()) {
  //   char incoming[100];
  //   Serial1.readBytesUntil('\n',incoming,100);
  //   if(strncmp(incoming,"$GPRMC",6)==0) {
  //     strcpy(GPS,incoming);
  //     break;
  //   }
  // }

  // get magnetic heading
  int heading = (int)getHeading();

  // send location and heading to server
  // Serial.print("Heading,")
  // Serial.println(heading);
  // Serial.print("GPS,");
  // Serial.println(GPS);

  // // wait for the server to send back data, then read it
  // while(!Serial.available()) {}
  // char address[100];
  // char reldir[4];

  // // read address
  // int bytes = Serial.readBytesUntil('|',address,100);
  // address[bytes] = '\0'; // remove the trailing | character

  // // read direction
  // bytes = Serial.readBytes(reldir,3); // TODO: make sure we're sending 3 bytes

  // update and refresh screen
  newData = 1;
  drawAndRefresh(heading);

  // wait 500ms and repeat
  delay(500);
