high frequency PWM arduino admega

I got some problems with creating a high frequency pwm signal with an arduino admega2560 controlled by a potentiometer. I thought this code ( http://playground.arduino.cc/Code/PwmFrequency ) might be useful but i don't know how to implement this in my code. I now use this code:

int ledPin = 9;      

int analogPin = A3;   

int val = 0;        



void setup()

{

  pinMode(ledPin, OUTPUT); 

}



void loop()

{

  val = analogRead(analogPin);   

  analogWrite(ledPin, val / 4);  

}

but this only creates a 200hz signal and i need at least 10000hz. Please help.

but this only creates a 200hz signal and i need at least 10000hz.

The frequency of the on/off cycles, unless you've diddled with the timers, is 490Hz on some pins and 980Hz on others.

Let's start with what you are driving with PWM that you think needs PWM at 10000+ Hz.

The idea is to connect it to a ir2110 ( http://www.irf.com/product-info/datasheets/data/ir2110.pdf ) which will power 2 lowside mosfets. The whole system wil control a maxon electric motor. The reason I want a frequency as high as possible is that the car I am building needs to be as efficient as possible.

chanterheld: The idea is to connect it to a ir2110 ( http://www.irf.com/product-info/datasheets/data/ir2110.pdf ) which will power 2 lowside mosfets. The whole system wil control a maxon electric motor. The reason I want a frequency as high as possible is that the car I am building needs to be as efficient as possible.

Hello, i have the same problem, how you connect the arduino and drivr ir2110?