Using a potentiomenter (analog) to PWM control the LED with PWM
/*
SparkFun Inventor's Kit
Example sketch 02
POTENTIOMETER
*/
int sensorPin = 0;
int ledPin = 13;
void setup()
{
pinMode(ledPin, OUTPUT);
}
void loop()
{
int sensorValue;
sensorValue = analogRead(sensorPin);
digitalWrite(ledPin, HIGH);
delay(sensorValue);
digitalWrite(ledPin, LOW);
delay(sensorValue);
}