I want to generate a 15 kHz pulse with an Arduino using Timer1, but the problem is that if we want a 15000 Hz clock we need to initialize the timer with 1/15000 seconds or 66.66 microseconds, but we can only pass integers without any decimal precision in the Timer1.initialize(66);
function which generates a frequency of 15155 Hz.
So is it possible by any other means to generate an exact 15000 Hz or frequencies between 15000 Hz - 15155 Hz?
#include <TimerOne.h>
void setup() {
pinMode(9,OUTPUT);
Timer1.initialize(66); // Frequency, 100 µs = 10 kHz
Timer1.pwm(9,255);
}
void loop() {}