void loop() { rightSensorValue = analogRead(A0); // read the pot value // map the sensor value from the input range (400 - 900, for example) // to the output range (0-255). Change the values 400 and 900 below // to match the range your analog input gives: int brightness = map(rightSensorValue, 400, 900, 0, 255); analogWrite(redLED, brightness); // set the LED brightness with the result Serial.println(rightSensorValue); // print the sensor value back to the serial monitor