]> git.piffa.net Git - sketchbook_andrea/blobdiff - basic/analog_input/photo_5_calibration/photo_5_calibration.ino
ERRATA
[sketchbook_andrea] / basic / analog_input / photo_5_calibration / photo_5_calibration.ino
index db0d2b049db076cf64ca27fe556cc9eed1cf3120..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
@@ -78,3 +80,5 @@ Domande:
 1. Modificare lo sketch in modo che modifichi la luminosita' di un led 
 via PWM tramite il valore letto dal sensore.
 2. Come fare per costringere la variabile dentro un intervallo stabilito?
+*/
+