batata004:
If you are sure about what you are saying, so the energy is getting out of the VIN pin (instead of getting in) and I expected this may be causing my arduino death.
As I say, the regulator has a built-in diode that allows current to flow from the output to the input, and it's not intended for continuous current, so that's my guess as to what's going on.
Having noticed that you have a Nano, not an UNO, I'm assuming that they have the same or a similar regulator, so this would still apply. I can't read the regulator numbers from the Nano schematic I'm looking at now.
Your idea about using the DC input JACK is amazing but only if you are sure that energy cant get out of it. Does the DC POWER JACK only accepts energy in? Are you are it does not allow energy to get out?
There's a diode between the DC input jack and the Vin pin, intended to avoid damage ifthe power is connected in reverse-polarity, but it would also serve to stop current flowing back from 5V, through the regulator the the DC input jack.
I just went back and re-read your opening post, noticing that this is a Nano, not an UNO. A Nano doesn't have a DC input jack, does it, so that fix won't work. Adding a diode as you suggested is the answer then.
Forget everything I said about the DC input jack. It only applies to boards that actually have one. (I wasn't referring to the USB jack.)
Also, are you sure that when arduino is being powered by USB, it can allow energy to go out in the VIN pin? I took a great look at google and didnt find anything to support this.
As I mentioned, the diode that's built into the regulator would allow 5V to flow to the Vin pin.
Edit: This is from the NCP1117 datasheet:-
Protection Diodes
The NCP1117 family has two internal low impedance diode paths that normally do not require protection when used in the typical regulator applications. The first path connects between Vout and Vin
That's the regulator used in an UNO, so assuming the same or a similar low dropout regulator is used for the Nano, that will be where the current conducts back to the LED.
Edit2: As an afterthought: You could always solder an inline connector into the wire leading to the LED, so you can disconnect it for programming. You could just leave a short pigtail that you can plug the LED into.