   LED1 on bright when if either is on
   LED1 blinks if high temperature alarm is on
 
-  Receipt of any unrecognized commands cause the board to shutdown and  Reset is required.
+  Receipt of any unrecognized commands cause the board to shutdown and Reset is required.
 */
+
+// constants
+const String vers = "0.1";     // version of this firmware
+const int baud = 9600;         // serial baud rate
+const char sp = ' ';           // command separator
+const char nl = '\n';          // command terminator
+const int timeout = 120;       // device timeout in seconds
+
+// pin numbers corresponding to signals on the TC Lab Shield
+const int pinT1   = 0;         // T1
+const int pinT2   = 2;         // T2
+const int pinQ1   = 3;         // Q1
+const int pinQ2   = 5;         // Q2
+const int pinLED1 = 9;         // LED1
+
+// high limits expressed (units of pin values)
+const int limQ1   = 150;       // Q1 limit
+const int limQ2   = 150;       // Q2 limit
+const int limT1   = 310;       // T1 high alarm (50 deg C)
+const int limT2   = 310;       // T2 high alarm (50 deg C)
+
+// LED1 levels
+const int hiLED   =  50;       // high limit of LED
+const int loLED   = hiLED/16;  // low LED
 
 // global variables
 char Buffer[64];               // buffer for parsing serial input

  String data = read_.substring(idx+1);
  data.trim();
  pv = data.toInt();
}

// dispatch commands
void CommandDispatch(void) {
  // process commands
  if (cmd == "Q") {
    setHeater1(pv);
    setHeater2(pv);
  }
  else if (cmd == "Q1") {
    setHeater1(pv);
  }
  else if (cmd == "Q2") {
    setHeater2(pv);
  }
  else if (cmd == "T1") {
    float mV = (float)analogRead(pinT1) * (3300.0/1024.0);

  if (brdStatus > 0) {
    Q2 = max(0, min(limQ2, pv));
    analogWrite(pinQ2, Q2);
  }
}

