 	average = (int)(sum/50.0);
 
 	// limit sensor reading between min & max calibration values
-	average = min(average, max);	// min: the smaller of two numbers
-	average = max(average, min);	// max: the bigger of two numbers
+	average = min(average, max);  // min: the smaller of two numbers
+	average = max(average, min);  // max: the bigger of two numbers
 
 	return constrain(average, min, max);
 }
+

void setup() {

	// setup sensors as inputs
	pinMode(SENSOR_PIN, INPUT);
	pinMode(BRIGHTNESS_PIN, INPUT);

	FastLED.addLeds<NEOPIXEL, DATA_PIN>(smartLed, NUM_LEDS);
	setLedLevel(0);
	delay(400);	// add a short delay so the transition to real led level is more subtle
	for (int i = 0; i < MAX_LED_VALUE; i++) {
		setLedLevel(i);
		delay(10);
	}
}

void loop() {

void doUpdate() {
	int newLedLevel;
	// read the value from the sensor:
	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, MOISTURE_LEVEL_MIN, MOISTURE_LEVEL_MAX, 255, 1);

	// update if the value changes
	if (ledLevel != newLedLevel) {
