X-Git-Url: http://git.piffa.net/web?a=blobdiff_plain;f=basic%2Fanalog_input%2Fphoto_6_smooth%2Fphoto_6_smooth.ino;h=60913fe2414f3bdb931ce91f6a603f3de62ac5cf;hb=fd843739e632cc71f079bdf3c94d9d5f8e9a3b13;hp=9d1aa9c658d506e342361c16c54c4c9ca41a16f7;hpb=ca9bc9014acdfae3ee07d19650c547f02b796994;p=sketchbook_andrea diff --git a/basic/analog_input/photo_6_smooth/photo_6_smooth.ino b/basic/analog_input/photo_6_smooth/photo_6_smooth.ino index 9d1aa9c..60913fe 100644 --- a/basic/analog_input/photo_6_smooth/photo_6_smooth.ino +++ b/basic/analog_input/photo_6_smooth/photo_6_smooth.ino @@ -2,13 +2,16 @@ Smoothing Legge 10 valori dal sensore e ritorna il valore medio tra questi. + + Schema: https://learn.adafruit.com/assets/460 + */ // These constants won't change: const int sensorPin = A0; // pin that the sensor is attached to -const int ledPin = 9; // pin that the LED is attached to +const int ledPin = 11; // pin that the LED is attached to // variables: int sensorValue = 0; // the sensor value @@ -19,6 +22,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 @@ -62,7 +66,7 @@ int smoothRead(int sensorPin) { total = total + analogRead(sensorPin); delay(2); // Pausa per assestare il senstore } - return(total / 10); + return(total / 10); // Valore medio }