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

  float h = dht.readHumidity();
  float t = dht.readTemperature();

  // check if returns are valid, if they are NaN (not a number) then something went wrong!
  if (isnan(t) || isnan(h))
  {
    sensorTempData[0] = 0;
    sensorTempData[1] = 0;
  }
  else
  {
    sensorTempData[0] = (int)t;
    sensorTempData[1] = (int)h;
  }

#include <Time.h>       // For timekeeping
#include <Wire.h>       // For I2C

// Define LED pins (PWM pins: 3,5,6,9,10,11 on arduino UNO)
const int RED   = 11;
const int GREEN = 10;
const int BLUE  = 9;
const int PUMP  = 2;
const int NOZZLE = 12;
const int FAN = 7;
const int BOARDLED = 13; // Pin 13 and Arduino UNO board LED
const int LIGHT = A0;    // Light sensor, Analog pin 0
const int runInterval = 1;
const int measureInterval = 3600;


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

/**
 * User schedule of all settings
 * (7 settings, 1-9 predefined settinggroups, 1-7 days with 1h resolution)
 */
int num_usr_settings = 2;        // Setting sets available (Default: 2)
int num_usr_settings_day = 1;    // Day setting sets available (Default: 1)
const int NUM_SETTINGS = 7;      // Day setting sets
const int NUM_SETTINGS_DAY = 24; // Hour setting sets
// Setting sets
int usrSch[9][NUM_SETTINGS] = {
  {0,0,0,0,20,2,0}, // Spray the roots at a set interval and duration (Default)
  {0,0,0,1,20,2,0}, // Run the pump (Default)
  {25,25,0,0,20,2,0},
  {25,25,25,0,20,2,0},
  {50,50,50,0,20,2,0},
  {100,100,100,0,20,2,0},
  {100,100,100,0,20,2,0},
  {100,100,100,0,20,2,0},
  {100,100,100,0,20,2,0}
};
// Day setting sets (0:00-23:00)
int usrSchInd[NUM_SETTINGS][NUM_SETTINGS_DAY] = {
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0}, // Pump at 10:00 and 20:00
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0},
  {0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0}
};

// Variables for RGB levels
