From the programming examples it looks like the output pins can switch on/off at 1/1000 of a second. Is this true?
I need to get 20 KHZ on/off switching. Is there a way to do that?
If you want to do it with pure Arduino, the following code gives you 10.1kHz... not very clean, though.
int ledPin = 13; // LED connected to digital pin 13
void setup() // run once, when the sketch starts
{
pinMode(ledPin, OUTPUT); // sets the digital pin as output
}
void loop() // run over and over again
{
digitalWrite(ledPin, HIGH); // sets the LED on
delayMicroseconds(46); // waits for a second
digitalWrite(ledPin, LOW); // sets the LED off
delayMicroseconds(46); // waits for a second
}