 //#include "RTClib.h"
 //#include <SoftwareSerial.h>
 
+#define WAITING_FOR_START 1
+#define WAITING_FOR_END 2
+#define START_CHAR ':'
+#define END_CHAR '#'
+#define GET_RA "GR"
+#define GET_DEC "GD"
+#define CHANGE_PRECISION "U"
+
+
 // some types
 typedef struct {
   float time;

float obsTVector[3];
float obsCVector[3];

float obs[2];

// matricies

  invertMatrix(inverseTransformMatrix);
}

void processSerial()
{
  character = Serial.read();
  if (state == WAITING_FOR_START)
  {
    if (START_CHAR == character)
    {
      state = WAITING_FOR_END;
      command = "";
      lcd.setCursor(15,0);
      lcd.print((char)126);
    }
  } else if (state == WAITING_FOR_END)
  {
    if (END_CHAR == character)
    {
      lcd.setCursor(15,0);
      lcd.print((char)127);
      processCommand();
      state = WAITING_FOR_START;
      lcd.setCursor(15,0);
      lcd.print(" ");
    } else
    {
      command += character;
    }
  }
}

void processCommand()
{
  if (command == GET_RA)
  {
    Serial.print("#" + rad2hm(obs[0]) + "#");
    lcd.setCursor(15,1);
    lcd.print('R');
  } else if (command == GET_DEC)
  {
    Serial.print("#" + rad2dm(obs[1]) + "#");
    lcd.setCursor(15,1);
    lcd.print('D');
  } else if (command == CHANGE_PRECISION)
  {
    highPrecision = !highPrecision;
    clearScreen();
    lcd.setCursor(15,1);
    lcd.print('P');
  }
}

String rad2hm(float rad) {
  if (rad < 0) rad = rad + 2.0 * M_PI;
  float hours = rad * 24.0 / (2.0 * M_PI);
  float minutes = (hours - floor(hours)) * 60.0;

  if (highPrecision)
  {
    return padding((String)int(floor(hours)), 2) + ":" + padding((String)int(floor(minutes)), 2) + ":" + (String)int(floor((minutes - floor(minutes)) * 60.0));
  } else {
    return padding((String)int(floor(hours)), 2) + ":" + padding((String)int(floor(minutes)), 2) + "." + (String)int(floor((minutes - floor(minutes)) * 10.0));
  }
}

String rad2dm(float rad) {
