A Light Emitting Diode (LED)
is an electrical component that lights up when a current is passed through it.
- LEDs come in certain voltage ratings – you must use an LED with the correct voltage rating for it to work.
- LEDs are diodes – devices that only allow current to flow in one direction. If you plug an LED in the wrong way round it wont work.
- The short leg is usually the negative – end and the long leg is the positive end. Some LEDs also have a flat edge one their base that indicates the negative end.
- LEDs come in two varieties – Single colour LEDs that give off light of a certain colour. RGB LEDs which can be programmed to display any colour.
Tutorial Video
Wiring Up the components
Photo
Image
Python Code
Coding use Python is even easier than using JavaScript Code Kingdoms!
Challenge 1 – Flashing LED
Follow the tutorial video to get your LED flashing on and off every second.
Challenge 2 – SOS LED
Get your LED to flash the Emergency Morse code SOS
3 times:
- Long Flash
- 1 second pause
3 times:
- Short Flash
- 1 second pause
3 times:
- Long Flash
- 1 second pause
10 second pause
Repeat
Challenge 3 – Alternating LEDs
Wire up 2 leds and get them to flash alternately every second.
Challenge 4 – Red Yellow Green
Wire up three lights and get them to light:
Red, then yellow, then blue
Challenge 5 – Traffic light LEDs
Wire up 3 LEDs (red,yellow,green) s so that they behave like a set of traffic lights.
- Green
- Yellow
- Red
- Wait 3 seconds
- Red and Yellow
- Green
- Repeat forever
Challenge 6 – Button operated traffic light
Adapt your challenge 4 code so that the traffic lights are controlled by pressing the button!