i'm using my arduino mega 1280 as the interface between x-sim and vehicle gauges,
i will be running 3 gauges with a pwm signal, (fuel, water and oil) which in the vehicle would be a variable resistance to earth to move the needle,
i'm using the standard 'analogWrite' function, the gauges work, but the coils in the gauge sing,
Someone said a good way to stop the noisy gauges is to change the pwm frequency to 31Khz,
But i'm getting confused by googleing, and especially the problems with certain counters being messed up when you alter the frequency of certian timers,
I believe there is a timer on the mega that runs 3 of the pwm pins,
can someone please show me how i change the frequency to 31Khz for these pins, idealy with some code in the script, so i can upload other scripts and have it back to normal.
i'm using the serial port (usb) as the connection to x-sim, and the tone lib. to feed the variable frequency to the rev counter and speedo, and will be driving 4 servo's as well,