 const int pinLED1 = 9;         // LED1
 
 // high limits expressed (units of pin values)
-const int limLED1 =  50;       // LED1 limit
 const int limQ1   = 150;       // Q1 limit
 const int limQ2   = 150;       // Q2 limit
 const int limT1   = 310;       // T1 high alarm (approx. 50 deg C)
 const int limT2   = 310;       // T2 high alarm (approx. 50 deg C)
 
+// LED1 levels
+const int hiLED   =  50;       // high limit of LED
+const int loLED   = hiLED/16;  // low LED
+
+void setHeater1(int pv) {
+  if (brdStatus > 0) {
+    Q1 = max(0, min(limQ1, pv));
+    analogWrite(pinQ1, Q1);
+    Serial.println(Q1);
+  }
+}
+
+void setHeater2(int pv) {
+  if (brdStatus > 0) {
+    Q2 = max(0, min(limQ2, pv));
+    analogWrite(pinQ2, Q2);
+    Serial.println(Q2);
+  }
+}
 
 // parse serial input
 void SerialParse(void) {

  This firmware is initially loaded into the Temperature Control Laboratory Arduino. 
  The firmware scans the serial port looking for case-insensitive commands:

  Q int     set Heater 1, range 0 to 255,  limit to 150 to prevent overheating
            (note: Q turns off Heater 2 as safety precaution)
  Q1 int    set Heater 1, range 0 to 255,  limit to 150 to prevent overheating
  Q2 int    set Heater 2, range 0 to 255,  limit to 150 to prevent overheating
  T         get Temperature T1, returns deg C as sring
  T1        get Temperature T1, returns deg C as string
  T2        get Temperature T2, returns dec C as string
  VERSION   get firmware version string
  X         shutdown, set Q1, Q2 to zero

  LED1 is on during normal operation.

  LED1 is on bright for high temperature alarm.

  Receipt of any unrecognized commands cause the board to shutdown and report
  status by blinking LED1. Reset is required.
*/

// global variables
char Buffer[64];               // buffer for parsing serial input
String cmd;                    // command 
int pv;                        // command pin value

// constants
const String vers = "0.1";     // version of this firmware

    ; // wait for serial port to connect.
  }
  Serial.flush();
  setHeater1(0);
  setHeater2(0);
}

// arduino main event loop
void loop() {
  SerialParse();
  CommandDispatch();
  AlarmCheck();
  LEDUpdate();
}
