How do you plan to solve it?
/*Paste your code here*/ #define potpin A0 void setup() { pinMode(9, OUTPUT); // Set Fast PWM on Timer1, change prescaler TCCR1A = _BV(COM1A1) | _BV(WGM11); // non-inverting mode, Fast PWM TCCR1B = _BV(WGM12) | _BV(CS11); // prescaler = 8, PWM freq = 7.8kHz } void loop(){ int potval = analogRead(potpin); int led = map(potval, 0, 1023, 0, 255); OCR1A = led; // Duty cycle delay(10); }
Add video of output (know more)
Add a photo of your hardware showing the output.
Submit Your Solution