How do you plan to solve it?
Connect pot to any analog pin and use map function to scale the value from 0 to 1023 to 0 to 255. Used this scaled value to control the LED.
#define POTENTIOMETER A0 #define LED 9 int potValue = 0; void setup() { pinMode(POTENTIOMETER, INPUT); pinMode(LED, OUTPUT); } void loop() { potValue = analogRead(POTENTIOMETER); potValue = map(potValue, 0, 1023, 0, 255); analogWrite(LED, potValue); }
Video of output (know more)
Submit Your Solution