How do you plan to solve it?
/*Paste your code here*/ void setup() { pinMode(9, OUTPUT); pinMode(A0, INPUT); // Timer1 Fast PWM (Mode 14), non-inverting, prescaler = 8 TCCR1A = _BV(COM1A1) | _BV(WGM11); TCCR1B = _BV(WGM13) | _BV(WGM12) | _BV(CS11); ICR1 = 399; // 5 kHz PWM OCR1A = 0; // start with 0% duty } void loop() { uint16_t pot = analogRead(A0); // 0–1023 // Map POT value to duty cycle (0 → ICR1) OCR1A = (pot * ICR1) / 1023; delay(5); // small delay for stability }
Add video of output (know more)
Add a photo of your hardware showing the output.
Submit Your Solution