]> git.piffa.net Git - sketchbook_andrea/blobdiff - basic/analog_input/photo_5_calibration/photo_5_calibration.ino
State machine e blinks con millis()
[sketchbook_andrea] / basic / analog_input / photo_5_calibration / photo_5_calibration.ino
index ea8ecf8c4a31df50827ae18d1a61a4e5039a438f..fd86f7f641cd6b0e494f66157ec972d53a9d2e2d 100644 (file)
@@ -39,6 +39,7 @@ int sensorMax = 0;           // maximum sensor value
 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 
@@ -54,6 +55,7 @@ void setup() {
     if (sensorValue < sensorMin) {
       sensorMin = sensorValue;
     }
+    delay(5); // Let the sensor rest a bit and stabilize
   }
 
   // signal the end of the calibration period