electricpy.led_resistor¶
- electricpy.led_resistor(Vsrc, Vfwd=2, Ifwd=20)[source]¶
LED Resistor Calculator.
This function will evaluate the necessary resistance value for a simple LED circuit with a voltage source, resistor, and LED.
\[R_\text{LED} = \frac{V_\text{SRC} - V_\text{FWD}}{I_\text{FWD}}\]- Parameters:
Vsrc (float) – Source voltage, as measured across both LED and resistor in circuit.
Vfwd (float, optional) – Forward voltage of LED (or series LEDs if available), default=2
Ifwd (float, optional) – Forward current of LEDs in milliamps, default=20 (milliamps)
- Returns:
R – The resistance value most appropriate for the LED circuit.
- Return type:
float