An LED can be dimmed by quickly turning it on and off, several times a second. By varying the mark space ratio, the brightness is varied.
A simple implementation of a PWM system would be a clock feeding an LED and protective resistor to the ground.
The clock should ideally oscillate at a frequency of 50Hz to ensure that you will not see the oscillation. To test this, you can either use a signal generator to provide a square wave, as below, or create a circuit to do it for you.
Step 1: Relaxation Oscillator
The capacitor C1 charges and discharges through the resistor R1, and the time taken for this cycle to occur is the period of the waveform.