A blue LED (Light-Emitting Diode) with two pins is a semiconductor light source that emits blue light when an electric current passes through it. This type of LED is widely used in various applications such as indicator lights, backlighting, display panels, and DIY electronics projects due to its bright and vibrant color.
Pin Number | Name | Description |
---|---|---|
1 | Anode (+) | Longer pin, to be connected to the positive supply voltage |
2 | Cathode (-) | Shorter pin, to be connected to the ground (GND) |
R = (Vsupply - Vf) / If
.// Define the pin where the LED is connected
const int ledPin = 13; // LED connected to digital pin 13
void setup() {
pinMode(ledPin, OUTPUT); // Set the LED pin as an output
}
void loop() {
digitalWrite(ledPin, HIGH); // Turn the LED on
delay(1000); // Wait for a second
digitalWrite(ledPin, LOW); // Turn the LED off
delay(1000); // Wait for a second
}
Note: When connecting the LED to an Arduino, ensure you use a current limiting resistor (typically 220 ohms for a 5V supply) between the digital pin and the anode of the LED.
Q: Can I connect the LED directly to a 5V supply? A: No, you should always use a current limiting resistor to protect the LED from drawing too much current.
Q: How do I know if my LED is damaged? A: If the LED does not light up when the correct voltage is applied, and all connections are correct, it may be damaged.
Q: Can I use a 9V battery to power the LED? A: Yes, but you will need to calculate the value of the current limiting resistor accordingly to handle the higher voltage.