const int ledPin = 2; // LED connected to PWM pin 5
const int potPin = 13; // Potentiometer connected to analog pin A0
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(potPin, INPUT);
Serial.begin(115200);
}
void loop() {
int potValue = analogRead(potPin); // Read potentiometer value (0-4095)
Serial.println(potValue);
// Map the potentiometer value to the PWM range (0-255)
//int brightness = map(potValue, 0, 4095, 0, 255);
analogWrite(ledPin, potValue); // Set LED brightness
delay(10); // Small delay for stability
}