Hey guys,
I noticed when I use Arduino's PWM to control DC motors, I can hear some annoying "singing", and I've been told this is because Arduino's PWM frequency is somewhere between 0-22,000Hz where the human ear can hear it.
I want to change this PWM frequency to something higher, so I looked up the datasheet for the Atmega328P and changed the registers as follows (Fast PWM, No prescaler, PWM frequency around 62kHz):
TCCR1A=TCCR1A&0xA1;
TCCR1B=TCCR1B&0x09;
TCCR0A=TCCR0A&0xA3;
TCCR0B=TCCR0B&0x01;
TCCR2A=TCCR2A&0xA3;
TCCR2B=TCCR2B&0x01;
I can't hear the motors anymore which is good, but the rest of my code has gone completely bonkers and doesn't do what it's supposed to do anymore. Could anyone shed some light onto what could possibly be the matter?
Thankyou

Andrew