Red and Green LED lights
LED stands for Light Emitting Diode, and glows when electricity is passed through it.
The LED has one leg is longer than the other. The longer leg (known as the ‘anode’), is always connected to the positive supply of the circuit. The shorter leg (known as the ‘cathode’) is connected to the negative side of the power supply, known as ‘ground’. LEDs will only work if power is supplied the correct way round (i.e. if the ‘polarity’ is correct).
The Raspberry Pi's GPIO Pins
GPIO stands for General Purpose Input Output. It is a way the Raspberry Pi can control and monitor the outside world by being connected to electronic circuits. The Raspberry Pi is able to control LEDs, turning them on or off, or motors, or many other things. It is also able to detect whether a switch has been pressed, or temperature, or light. In the CamJam EduKit you will learn to control LEDs and a buzzer, and detect when a button has been pressed.
In the Schematics it is directly connected to Pin 7 of the 40 Pin Connector. This corresponds to the GPIO4 Pin.
This is the location of the Green LED on the board.
Following python code can be used to turn the LED on or off.
Exercise 1 – Turn on Red LED in place of Green LED
Exercise 2 - Turn Green and Red LED ON off Alternatively
Exercise 3 - Turn Green and Red LED ON off Alternatively