PWM

/*
Blink
Turns on an LED on for one second, then off for one second, repeatedly.

This example code is in the public domain.
*/

// Pin 13 has an LED connected on most Arduino boards.
// give it a name:
int led = 3;
int led13 = 13;
// the setup routine runs once when you press reset:

// the loop routine runs over and over again forever:
void setup()
{

pinMode(3, OUTPUT);
pinMode(13, OUTPUT);
}

void loop()
{
digitalWrite(3, HIGH);
digitalWrite(13, HIGH);
delayMicroseconds(100); // Approximately 10% duty cycle @ 1KHz
digitalWrite(3, LOW);
digitalWrite(13, LOW);
delayMicroseconds(1000 – 900);
}