I'm making a class D amplifier as a school project, and we are currently at a stage where we simply need to add the comparator. But the comparator (LM311n) does not seem to run as intended.
My triangle and audio wave are both lifted above ground and referenced to an artificial ground at 5 V.
The signal we get from the comparator is weird looking:
The triangle wave is running at 250 kHz and the audio is running at around 10 kHz. Both audio and triangle is running as intended so I figure my problem is with the comparator as the signal is kind of messed up. Anyone know how I can use the LM311n as a normal comparator to make the PWM signal that drives a speaker? If so I could really use input on how to do so.