- int calValue = map(sensorValue,min,max,0,1024) ;
- // Max pausa = 1024
- // turn the ledPin on
- digitalWrite(ledPin, HIGH);
- // stop the program for <sensorValue> milliseconds:
- delay(calValue);
- // turn the ledPin off:
- digitalWrite(ledPin, LOW);
- // stop the program for for <sensorValue> milliseconds:
- // print the results to the serial monitor:
+ delay(5); // stabilizziamo il sensore
+ int calValue = map(sensorValue,min,max,0,255) ;
+ analogWrite(ledPin, calValue);
+ // Debug, per disabilitarlo togliere l'inizializzazione della seriale
+ // dal setup()