Hello!
I am new to embedded programming and the forums. For my first task I am trying to generate a clean square wave with a configurable frequency and I figured PWM would be a good way to do this. Below is my code. This works to an extent, but during the off time there are regular spikes to 3.6V at about 10kHz as seen in my scope plot. The scope is a cheap Rigol DS1102.
How can I eliminate these spikes? and is my approach the best approach or is there a better one that may not have the extra spikes?
thanks in advance for the help!
void setup() {
// declare pin 14 to be an