Issue with L.E.D and Vin Input voltage

Hi,

I connected a Cree L.E.D to a button, wrote a simple sketch to control different light modes, and tested

it. It worked. I decided that I would like to use the Vin pin on my Arduino Uno and operate the circuit

with a 9 volt battery. I would like to install a 5 volt voltage regulator for the L.E.D. One wire from my

L.E.D is connected to ground and the other to a digital pin. I know how the voltage regulator works

basically pin one is the voltage that I want to limit, pin two is the ground pin, and the third pin is the

adjusted output voltage based upon the regulator which in my case is five volts. Since the L.E.D is

connected how do I add the regulator to limit my L.E.D voltage to five volts?

I tried connecting the 9 volt to Vin and ground. I board lit up but I decided to jump online because my

common sense kicked in and told me that was a bad idea so here I am. Also, I don't understand

what is meant by limiting the current to I believe it's 40mAs per pin.

Thank you for your time.

LED turns into basically a short circuit once the voltage reaches a high enough level (Vf) to turn it on. So you need a series resistor to limit the current going thru it.
Say the LED had a Vf of 3.2V.
Then you could limit the current to 20mA (safe level from an Arduino pin) with a suitable resistor. If the LED has 3.2V across it, the resistor must have 1.8V across it; 5V - 3.2V = 1.8V.
Now using Ohms Law, Voltage = Current x Resistance, or Voltage/Current = Resistance:
1.8V/.02A = 90 ohm
So try a 100 ohm resistor and see how it looks.

Please do not post pictures that are not focused and therefore, useless.

Take it outside in bright daylight, keep at least a meter back and use the camera zoom.

Please post the specification (link) of the Cree LED.

By "9V battery", surely you do not mean a "PP3"?

@CrossRoads

Thank you, I understand Ohms Law. I was confused where I would connect the resistor then I figured it out. I was sick. I apologize for the late reply. Thank you

@Paul__B

Okay, and yes.

Are you up & running now, and feeling better?

The Ohms Law explanation may help someone else out, never hurts to explain it one more time ...