How would I go about changing the frequency of the analogWrite() function in Arduino?
I would ordinarily use the tone() function in this situation however, this is currently tied up with something else and noTone() cannot be called.
The problem I am having is with the default frequency of the analogWrite() function aliasing occurs with my reading on the ultrasonic sensor and I receive values that are a factor of ten off what they should be. I have tested the sensor at a range of frequencies and it appears to work best at about 50 Hz.
Any help would be greatly appreciated.