Initially, I thought of using the usual micros() to set the output for the LED. Soon, I found out that micros() is not very accurate. 4us resolution and too much overhead for producing stable frequency. Even though I replaced the micros() with another library , it seems that software-based waveform generation is not too reliable.
Then I discovered PJRC's FrequencyTimer2 library. A little less flexible, since it only allow you to output waveform on pin 11. I was prototyping this on a perfboard and with Arduino's standard digital pin spacing I need to drill a set of new holes, so I'm moving to Arduino Nano and custom PCB.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.