int sensorPin = A0; // select the input pin int sensorValue = 0; // variable to store the value coming from the sensor int rawHigh = 250; int rawLow = 1023; int toHigh = 0; int toLow = 100; void setup() { Serial.begin(2000000); // initialise serial communication at this baud rate } void loop() { sensorValue = analogRead(sensorPin); // read the value from sensorPin to sensorValue sensorValue = map(sensorValue, rawLow, rawHigh, toLow, toHigh); sensorValue = constrain(sensorValue, 0, 100); Serial.println(sensorValue); // print sensorValue delay(100); // wait 1/10 of a second }