A yellow LED (Light-Emitting Diode) with two pins is a semiconductor light source that emits yellow light when an electric current passes through it. LEDs are widely used in various applications due to their low power consumption, long life, and compact size. Yellow LEDs are commonly used for indicators, decorative lighting, and in electronic devices to convey status or alerts.
Pin Number | Name | Description |
---|---|---|
1 | Anode (+) | The longer pin, to be connected to the positive supply voltage. |
2 | Cathode (-) | The shorter pin, to be connected to the ground (0V). |
R = (Vs - Vf) / If
, where Vs
is the supply voltage.// Define the LED pin
const int ledPin = 13; // Most Arduino UNO boards have an onboard LED on 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
}
Q: Can I connect multiple LEDs in series? A: Yes, but ensure that the supply voltage is high enough to account for the sum of the forward voltages of all LEDs, and use a single current-limiting resistor for the series circuit.
Q: What happens if I don't use a resistor with the LED? A: Without a resistor, the LED may draw excessive current, leading to overheating and potential failure.
Q: Can I use a variable resistor to adjust the LED brightness? A: Yes, a potentiometer can be used to vary the resistance and, consequently, the LED brightness. However, do not exceed the maximum forward current.