# define SENSORE A0 # define LED 9 int SensorValue = 0; int outputValue = 0; void setup() { pinMode(SENSORE, INPUT); pinMode(LED, OUTPUT); Serial.begin(9600);} void loop() { SensorValue = analogRead(SENSORE); outputValue = map(SensorValue, 0, 1023, 0, 255); analogWrite(LED, outputValue); Serial.print("sensor = " ); Serial.print(SensorValue); Serial.print("\t output = "); Serial.println(outputValue); delay(1000); }
Nessun commento:
Posta un commento