5mm Green LED (Pack of 10)
5mm Green LED (Pack of 10)
The 5mm Green LED is a light-emitting diode (LED) component that emits green light when an electric current passes through it. This component is commonly used in various electronic circuits, prototypes, and projects to indicate status, provide visual feedback, or create visual effects. The pack of 10 LEDs offers a convenient and cost-effective solution for designers and developers working on multiple projects or requiring a bulk supply.
The primary function of the 5mm Green LED is to convert electrical energy into light energy. When a forward bias voltage is applied to the LED, the electrons recombine with holes, releasing energy in the form of green light. The LED acts as a unidirectional light source, emitting light in a particular direction.
By understanding the features, functionality, and applications of the 5mm Green LED, designers and developers can effectively integrate this component into their projects, ensuring reliable and efficient operation.
5mm Green LED (Pack of 10) DocumentationComponent OverviewThe 5mm Green LED is a standard through-hole LED component, suitable for a wide range of IoT projects. This pack of 10 LEDs provides an affordable and convenient solution for prototyping and development.Component SpecificationsLED Type: 5mm Through-Hole
Color: Green
Forward Voltage: 2.0-2.5V
Forward Current: 20mA
Luminous Intensity: 100-150mcd
Viewing Angle: 30-40 degrees
Operating Temperature: -25C to 85CCode Examples### Example 1: Basic LED Blinking using ArduinoIn this example, we will connect the 5mm Green LED to an Arduino board and create a simple blinking effect.Hardware RequirementsArduino Board (e.g., Arduino Uno)
5mm Green LED (from the pack of 10)
220 Resistor
Breadboard and jumper wiresCode
```c
const int ledPin = 13; // choose a digital pin for the LEDvoid setup() {
pinMode(ledPin, OUTPUT);
}void loop() {
digitalWrite(ledPin, HIGH); // turn the LED on
delay(1000); // wait for 1 second
digitalWrite(ledPin, LOW); // turn the LED off
delay(1000); // wait for 1 second
}
```
ExplanationIn this example, we connect the 5mm Green LED to digital pin 13 of the Arduino board through a 220 resistor. In the `setup()` function, we set the pin as an output. In the `loop()` function, we toggle the LED on and off using `digitalWrite()` with a 1-second delay between each state.### Example 2: RGB LED Strip Control using Raspberry Pi (Python)In this example, we will connect the 5mm Green LED to a Raspberry Pi and control it as part of an RGB LED strip using Python.Hardware RequirementsRaspberry Pi (e.g., Raspberry Pi 4)
5mm Green LED (from the pack of 10)
RGB LED Strip (with separate connections for each color)
Breadboard and jumper wires
Power supply for the LED stripCode
```python
import RPi.GPIO as GPIO
import time# Set up GPIO mode
GPIO.setmode(GPIO.BCM)# Define LED pin assignments
green_led_pin = 17# Set up LED pin as output
GPIO.setup(green_led_pin, GPIO.OUT)try:
while True:
# Turn green LED on
GPIO.output(green_led_pin, GPIO.HIGH)
time.sleep(1)
# Turn green LED off
GPIO.output(green_led_pin, GPIO.LOW)
time.sleep(1)except KeyboardInterrupt:
# Clean up GPIO on exit
GPIO.cleanup()
```
ExplanationIn this example, we connect the 5mm Green LED to GPIO pin 17 of the Raspberry Pi board. We use the RPi.GPIO library to control the LED. In the main loop, we toggle the green LED on and off using `GPIO.output()` with a 1-second delay between each state.Note: These code examples are for illustration purposes only and may require modifications to work with specific IoT projects. Always ensure proper circuit design, component selection, and safety precautions when working with electronics.