int vr_pin = A0; // Potentiometer pin
int led_pin = 10; // LED pin
void setup() {
pinMode(vr_pin, INPUT); // Corrected the pinMode function
Serial.begin(9600); // Initialize serial communication at 9600 bps
}
void loop() {
int vr = analogRead(vr_pin); // Read the analog value from the potentiometer
int vrl = map(vr, 0, 1023, 0, 255); // Map the analog value to 0-255 range
analogWrite(led_pin, vrl); // Write the mapped value to the LED
Serial.println(vrl); // Print the value to the serial monitor
delay(500); // Wait for half a second
}