Hello everyone, i am using a simple sketch for a PWM signal, However every time i need to change the frequency i have to upload a new sketch, is there a way to set the frequency using a 2nd pot ?
Code:
#include <PWM.h>
int32_t frequency = 25000;
const int Pin = 9;
int PWM = 0;
void setup() {
InitTimersSafe();
bool succes = SetPinFrequencySafe(9, frequency);
}
void loop() {
PWM = map(analogRead(A0), 0, 1023, 0, 255);
analogWrite (Pin, PWM);
delay(100);
}