View Single Post
  #1   Spotlight this post!  
Unread 26-01-2009, 15:45
Bryscus's Avatar
Bryscus Bryscus is offline
EE, CpE
AKA: Bryce B.
FRC #0180 (SPAM)
Team Role: Engineer
 
Join Date: Jan 2009
Rookie Year: 1999
Location: Jupiter, FL
Posts: 173
Bryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud ofBryscus has much to be proud of
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.
Reply With Quote