Dimming LED
Below is an example of what it would look like if you build this circuit with an Arduino kit. We will build this step-by-step in TinkerCad Circuits:
Step 1: Find the sample code in Arduino
The code for this project can be found: File > Examples > 01. Basics > Fade
Look closely at comments to see how the code works.
“analogWrite” means we will be using pin 9 for PWM (Pulse Width Modulation).
PWM is used to quickly turn off and on a light or a motor in order to dim or slow the device. Only pins with a “~” will work for this.

Step 2: Wiring the circuit
For this project, connect the positive leg of your LED to digital output pin 9 on your board, and the circuit could look like this:
After we paste the code and start the simulation, the LED on the breadboard should fade off and on.
Bonus:
Alter the code to change the speed of the fade.
So the “delay” at the end of the code controls the speed of the fade.
Try changing the value of the delay and see how it changes the fading effect!
Introduction |
Lesson One: System Design |
Lesson Two: Basic Circuitry Knowledge |
Lesson Three: Electronics Tools |
Lesson Four: Lighting an LED |
Lesson Five: Tilt Switch |
Lesson Six: Photoresistor and LED |
Lesson Seven: Button with Piezo Speaker |
Lesson Eight: Dimming an LED |
Lesson Nine: Button Input for LED |
Lesson Ten: Ultrasonic Sensor Alarm |
Further Resources |