 		setLedLevel(ledLevel);
 	}
 
-	// debug data
-	Serial.print("[DEBUG]: current value, led level: ");
-	Serial.print(sensorValue);
-	Serial.print("\t");
-	Serial.println(ledLevel);
 }
 
 /**
- * Ligts LEDs according to given level where 0 is all LEDs are OFF and 5 is all LEDs are ON
+ * Ligt the LED according to given level where 0 is LED OFF and 255 green
  * @param Integer level number of leds to light up from 0 to 5
  */
 void setLedLevel(int level) {
-	if (level < 0) level = 0;
-	if (level > (ledArraySize) ) level = ledArraySize;
+	int ledR = 0,
+		ledG = 0,
+		ledB = 0;
 
-	for (int pin = 0; pin < ledArraySize; pin++ ) {
-		pinMode(ledPins[pin], OUTPUT);
-		if (level >= pin+1)
-			digitalWrite(ledPins[pin], HIGH);
-		else
-			digitalWrite(ledPins[pin], LOW);
+	int brightnessValue = readSensor(BRIGHTNESS_PIN, 0, 200);
+
+	// turn off LED if level is zero
+	if (level == 0) {
+		FastLED.setBrightness(BRIGHTNESS_OFF);
+	} else {
+		if (brightnessValue > BRIGHTNESS_THRESHOLD) FastLED.setBrightness(BRIGHTNESS_MAX);
+		else FastLED.setBrightness(BRIGHTNESS_MIN);
 	}
+
+	// reverse LED level so red is shown when the soil is dry and green when moist
+	level = map(constrain(level, 0, MAX_LED_VALUE), 0, 255, 255, 0);
+
+	// this changes the led color from red to yellow to green
+	ledR = constrain(2 * level, 0, 255);
+	ledG = constrain(2 * (255 - level), 0, 255);
+
+	// set led color and show it to the world
+	smartLed[0].setRGB(ledR, ledG, ledB);
+	FastLED.show();
 }
 
 /**
  * Read moisture sensor multiple times and return the average
  * @return Integer
  */
-int readSensor() {
+int readSensor(int sensorPin, int min, int max) {
 
 	int average;
 	float sensorValue, sum;
 	for (int i = 0; i < 50; i++) {
-		sensorValue = analogRead(SENSOR_PIN);
+		sensorValue = analogRead(sensorPin);
 		sum += sensorValue;
 		delay(1);
 	}

// 0% humidity (air):	575
// 100% humidity (water): 285
#define MIN_LEVEL 300	// 99% humidity
#define MAX_LEVEL 550	// 1% humidity
#define LOW_LEVEL_THRESHOLD 1	// minimum threshold for the water level (=desert dry soil)

int ledPins[] = {3, 4, 5, 6, 7, 8, 9, 10, 11};
int ledArraySize = (sizeof(ledPins)/sizeof(int));

int sensorValue = 0;  // variable to store the value coming from the sensor

int ledLevel = 0;

bool blink = false;


	if ((unsigned long)(currentTime - flashTimer) >= FLASH_TIME_INTERVAL) {

		if (ledLevel <= LOW_LEVEL_THRESHOLD) {
			if (blink) setLedLevel(0); // turn off all LEDs
			else setLedLevel(ledLevel);
			blink = !blink;
		}

