void loop() { analogValue = analogRead(A0); // read the pot value brightness = analogValue /4; //divide by 4 to fit in a byte analogWrite(ledPin, brightness); // PWM the LED with the brightness value Serial.println(brightness); // print the brightness value back to the serial monitor }