 long time = 0;
 int debounce = 200; //the debounce time, increase if the output flickers
 
-//flags
 boolean runGPS = false;
 
 TinyGPS gps;
 
-void createFile(char fname[40])
+void setUpdateRate()
 {
-  int wait = 100; //delay to send commands to openlog
-  gss.write(26);
-  gss.write(26);
-  gss.write(26);
+  device.write((byte)0xA0); //A0
+  //device.print(160, HEX);
+  delay(200);
   
+  device.write((byte)0xA1);  //A1
+  //device.print(161, BIN);
+  delay(200);
   
-  gss.print("new ");
-  gss.print(fname);
-  gss.print("/r");
-  delay(wait);
-  gss.print("append ");
-  gss.print(fname);
-  gss.print("/r");
-  delay(wait);
+  device.write((byte)0x00);    //00
+  //device.print(0, BIN);
+  delay(200);
+  
+  device.write((byte)0x03);    //03
+  //device.print(3, BIN);
+  delay(200);
+  
+  device.write((byte)0x0E);   //0E
+  //device.print(14, BIN);
+  delay(200);
+  
+  device.write((byte)0x05);   //10 10Hz
+  //device.print(05, BIN);
+  delay(200);
+  
+  device.write((byte)0x01);
+  //device.print(1, HEX);
+  delay(200);
+  
+  device.write((byte)0x0A);
+  //device.print(10, HEX);
+  delay(200);
+  
+  device.write((byte)0x0D);
+  //device.print(13, BIN);
+  delay(200);
+
+  device.write((byte)0x0A);
+  //device.print(10, HEX);
+  delay(200);
+ 
+  if (gss.available() > 0)
+  {
+    Serial.print(gss.read(), HEX);
+  }
 }
 
-void setGPSBaud()
+void setBaud()
 {
-  device.write((byte)160); //A0
-  delay(50);
-  device.write((byte)161);  //A1
-  delay(50);
-  device.write((byte)0);    //00
-  delay(50);
-  device.write((byte)4);
-  delay(50);  
-  device.write((byte)5);    //messageID
-  delay(50);
-  device.write((byte)0);    //COM PORT
-  delay(50);
-  device.write((byte)3);    //BAUD RATE: 38400
-  delay(50);
-  device.write((byte)0);
-  delay(50);
-  device.write((byte)5);
-  delay(50);
-  device.write((byte)13);
-  delay(50);
-  device.write((byte)10);
-  delay(50);
+  device.write((byte)0xA0); //A0
+  
+  device.write((byte)0xA1);  //A1
+  
+  device.write((byte)0x00);    //00
+  
+  device.write((byte)0x04);    //03
+  
+  device.write((byte)0x05);   //0E
+  
+  device.write((byte)0x00);   //10 10Hz
+  
+  device.write((byte)0x01);
+  
+  device.write((byte)0x00);
+  
+  device.write((byte)0x04);
+  
+  device.write((byte)0xD0);
+
+  device.write((byte)0xA0);
+ 
+  if (gss.available() > 0)
+  {
+    Serial.print(gss.read(), HEX);
+  }
 }
 
-void setUpdateRate()
-{
-  device.write((byte)160); //A0
-  delay(50);
-  device.write((byte)161);  //A1
-  delay(50);
-  device.write((byte)0);    //00
-  delay(50);
-  device.write((byte)3);    //03
-  delay(50);
-  device.write((byte)14);   //0E
-  delay(50);
-  device.write((byte)10);   //10 10Hz
-  delay(50);
-  device.write((byte)0);
-  delay(50);
-  device.write((byte)15);
-  delay(50);
-  device.write((byte)13);
-  delay(50);
-  device.write((byte)10);
-  delay(50);
-}
 void setup()
 {
-  //delay(10000);
   pinMode(2, INPUT);
   pinMode(3, OUTPUT);
-  pinMode(13, OUTPUT);
+  pinMode(11, OUTPUT);
   
   Serial.begin(9600);
   gss.begin(9600);
   
-  setGPSBaud();
-  delay(1000);
-  setUpdateRate();
-  delay(1000);
-  
-  //attachInterrupt(2, pushButton, CHANGE);
- 
-  createFile("test.log");
+  attachInterrupt(2, pushButton, CHANGE);
 }
 
 void pushButton()

#include "TinyGPS.h"
#include <SoftwareSerial.h>

//gps serial port RX, TX
SoftwareSerial gss(9, 10);
SoftwareSerial device(11, 3);

//keep track of how long push button was pressed
int state = HIGH;

  }
  
  time = millis();
}

void getLocation()
