 
 int speed_offset = 31, l = 0, MIDPOINT = 128, 
     p = MIDPOINT, v = MIDPOINT, s = MIDPOINT, t = MIDPOINT;
-    
-int count;
+
+unsigned long startTime = millis();  //  time based on hardware register - Timer #0
+unsigned long interval1 = 1000; // one second interval
+int interval2 = 10; // multiple of interval1
+long count = 0; // counter for interval2
+unsigned long lastTime = 0;  // use for holding time of last interval
+
+int pin_read = 0; //  holds value of analog read
+float voltage = 0;  //  holds scaled value of voltage - adjusted for voltage divider
+float scale = 15.0/1023.0;  // scale factor for 3 to 1 voltage divider - 15V reduced to 5V
+
+// Note - this will not be neede for ROV pc board
+// led on pin 19 of ATmega328 breadboard to indicate if program is running - connected to pin 13 on Arduino boards
+int led = 13;
+int blink = 0;  // toggle to blink on/off - period = interval
 
 void setup(){
+  
+  Serial.begin(9600);
+  
+  Serial.println();
+  Serial.println("Begin");
 
-  Serial.begin(9600);
- 
+  // Output elapsed time  
+  elapsed_time_output(startTime);
+   
   tilt.attach(5);
   light.attach(6);
   port.attach(9);
   vertical.attach(10);
   starbord.attach(11);
 
-  count = 0;
+  
+  // initialize the digital pin as an output for led blink
+  pinMode(led, OUTPUT);     
+
 }
 
 void loop(){
+  
+  
   // ========================================================================================
   // ========================================================================================
   // Get commands from OpenROV
   // ========================================================================================
   // ========================================================================================
+    
   
   if (Serial.available()) {
     delay(30); // number of characters to be read?  buffer delay (TODO:  affects timing of sensors... fix this?)

  // Write commands to OpenROV
  // ========================================================================================
  // ========================================================================================
  
  // TODO: make these actually do something, just testing for now
  // once every 1,300 counts
  if (count % 1300 == 0){
    rov_analog_output(1, "float");
  }
  // once every 10,000 counts
  if (count == 10000){
    rov_analog_output(0, "salinity");
    count = 0;  // reset counter (this should be done by the longest "running" counter
  }
  count++;
}

// Actually create and send command

  Serial.write(cmd_output);
  Serial.write(out);
  Serial.write(";");    // command delimiter
  Serial.println();     // newline
}

// Output elapsed time
void elapsed_time_output(unsigned long sTime){
 #define SEC_PER_MIN 60
 #define SEC_PER_HOUR 3600
 unsigned long elapsedTime = (millis() - sTime)/1000;
 Serial.print("Elapsed time is ");
 Serial.print(elapsedTime/SEC_PER_HOUR);
 Serial.print(":");
 Serial.print((elapsedTime/SEC_PER_MIN) % SEC_PER_MIN);
 Serial.print(":");  
 Serial.println(elapsedTime % SEC_PER_MIN);
}
