   float pHStep;
 }
 params;
- 
+
 float pH;
 int adc_result;           // Used in function phProbe and case C for calibration of the probe
 const float vRef = 4.096; // Our vRef into the ADC wont be exact Since you can run VCC lower than Vref its best to measure and adjust here


// Define DHT11 sensor
#define DHTPIN 8         // what pin we're connected to
#define DHTTYPE DHT11    // DHT 11 
DHT dht(DHTPIN, DHTTYPE);// make the object



  pinMode(FAN, OUTPUT);
  pinMode(BOARDLED, OUTPUT);
  digitalWrite(BOARDLED, LOW);

  // Read info from eeprom, contains calibration values from before. If this is the first run time, use default probe settings.
  eeprom_read_block(&params, (void *)0, sizeof(params));
  if (params.WriteCheck != Write_Check) {
    reset_Params();
  }
}

void loop() {
  t = now();

  // Keep working as long as data is in the buffer
  while (Serial.available() > 0) {
    serialControl();
  }

  if (t < tDelay) {
    return;
  }

  if (runProgram == 1) {
    scheduleFromUser();
    setLight();
    setFan(fanStatus);

    /**
     * The scheduling is per hour, but running the pump for that long is
     * unnessesary since it only takes about 30s to fill the pressure
     * accumulator.
     * Only run the pump during the first minute of the scheduled hour.
     */
    if (pumpOn == 1 && minute(t) > 0) {
      pumpOn = 0;
    }
    setPump();
  }
  if (nozzleInterval-1 == minute(t) % nozzleInterval) {
    if (nozzleDuration > second(t)) {
      digitalWrite(NOZZLE, HIGH);
      oneReport = 1;
    }
    if (nozzleDuration <= second(t)) {
      digitalWrite(NOZZLE, LOW);
      if (oneReport == 1) {
        oneReport = 0;
        serialReport();
      }
    }
  }
  if (t >= tDelayMin) {
    readSensors();

    if (sensorTempData[0] >= 30 || sensorTempData[1] >= 50) {
      setFan(1);
    }
    if(sensorTempData[0] < 30 && sensorTempData[1] < 50) {
      setFan(0);
    }

    tDelayMin = t + measureInterval;
  }

  tDelay = t + runInterval;
}

/*
 * Messages consist of the letter S followed by
 * int(0-255),int(0-255),int(0-255),int(0-1),int(0-30),int(0-10),int(0-1)
 * S,255,255,255,0,20,5,0 (R,G,B,pump,nozzlieInterval,nozzleDuration,fan)
 */
void serialControl()
{
    char c = Serial.read();
    switch(c){
      case 'S':
      {
        rval   = Serial.parseInt(); //First valid integer
        gval   = Serial.parseInt(); //Second valid integer
