void setup() {
// turn on LED to signal the start of the calibration period:
pinMode(13, OUTPUT);
+ pinMode(ledPin, OUTPUT);
digitalWrite(13, HIGH);
// calibrate during the first five seconds
if (sensorValue < sensorMin) {
sensorMin = sensorValue;
}
+ delay(5); // Let the sensor rest a bit and stabilize
}
// signal the end of the calibration period