- int calValue = map(sensorValue,min,max,0,1000) ;
- // Max pausa = 1sec
- // turn the ledPin on
- digitalWrite(ledPin, HIGH);
- // stop the program for <sensorValue> milliseconds:
- delay(calValue);
- // turn the ledPin off:
- digitalWrite(ledPin, LOW);
+ delay(5); // stabilizziamo il sensore
+ int calValue = map(sensorValue,min,max,0,255) ;
+ analogWrite(ledPin, calValue);