|
Re: Digital Outputs on the Driver Station with C/C++
Here's how to quickly calculate what resistor you should use for your LED. You will need to know the current consumption of the LED and the forward voltage of the LED (when a diode turns on, it more or less maintains a constant voltage accross itself). The relationship between current, resistance and voltage is defined in Ohm's law, V = IR (where V is voltage, I is current and R is resistance).
Vf = forward voltage of the diode
Id = diode current
The voltage supplied by the digital I/O port is 5V.
Since the diode and resistor are in series, they will have the same current flowing through them.
This means that the voltage accross the diode added to the voltage accros the resistor must equal 5 volts. Thus, 5V = Vf + (Id * R).
or R = (5V - Vf ) / Id
Hope that's a help as well...
__________________
The opulence of the front office decor varies inversely with the fundamental solvency of the firm.
|