 void doUpdate() {
 	int newLedLevel;
 	// read the value from the sensor:
-	sensorValue = readSensor(SENSOR_PIN, MIN_LEVEL, MAX_LEVEL);
+	sensorValue = readSensor(MOISTURE_SENSOR_PIN, MOISTURE_LEVEL_MIN, MOISTURE_LEVEL_MAX);
+	brightnessValue = readSensor(PHOTORESISTOR_PIN, 0, 1024); //
 
 	// sensor values are reversed (bigger value is dry and smaller value is moist)
-	newLedLevel = map(sensorValue, MIN_LEVEL, MAX_LEVEL, 255, 1);
+	newLedLevel = map(sensorValue, MOISTURE_LEVEL_MIN, MOISTURE_LEVEL_MAX, 255, 1);
 
 	// update if the value changes
 	if (ledLevel != newLedLevel) {

 * @return Integer
 */
int readSensor(int sensorPin, int min, int max) {

	int average;
	float sensorValue, sum;
	for (int i = 0; i < 50; i++) {
		sensorValue = analogRead(sensorPin);
		sum += sensorValue;

#define MAX_LED_VALUE 255

// timer and sensor
#define TIME_INTERVAL 1000  // 1 second interval
#define FLASH_TIME_INTERVAL 400 // 400 ms flash interval
#define MOISTURE_SENSOR_PIN A1    // input pin for the sensor

// To test the capacitive sensor put it in a body of water and read the value of 100 % humidity
// 0 % is measured when the sensor is held in air and not touching anything.
// moisture sensor test values:
// 0% humidity (air): 575
// 100% humidity (water): 285
#define MOISTURE_LEVEL_MIN 300  // 99% humidity
#define MOISTURE_LEVEL_MAX 450  // 1% humidity
#define LOW_LEVEL_THRESHOLD 1 // minimum threshold for the water level (=desert dry soil)

#define BRIGHTNESS_OFF 0
#define BRIGHTNESS_MIN 10
#define BRIGHTNESS_MAX 150
#define BRIGHTNESS_THRESHOLD 70
#define PHOTORESISTOR_PIN A2

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

int ledLevel = 0;
CRGB smartLed[NUM_LEDS];
