Find the datasheet for your particular LED...
Look up 'Forward Voltage'...assume it's 1.5v for example.
Now look up 'Current'...assume in this case it's 35mA, 'cause that's what you said it was
And you're driving the LED from a PIC pin at 5V
The LED will 'drop' 1.5v across it 'cause it's a diode and that's just the way they are...
So, that leaves you with 3.5v to work with.
The LED wants 35mA (.035A)
Ohms Law - I=V/R, V=IR, R=V/I
R (ohms you need) = V (volts, 3.5V) / I (35mA)
R = 100 ohms...
But that'll allow up to 35mA per PIC pin, over the limit...but you're driving the LED from 2 pins (unless I misunderstood).
So, R = 200 ohm across each PIC pin will give you 17.5mA from each pin, paralleled to the LED.
But I gotta tell you, it'll work, but it's not 'the way to do it'. The right way to do it is to add an external transistor or MOSFET to turn the LED on or off.
Or you could just increase the resistor value and use one pin... Like you said, the LED will be dimmer.
Bookmarks