Try this as the loop function of your Arduino sketch:
void loop() {
pinMode(2, INPUT_PULLUP); //Pull up is built in to the Atmega chip.
//It will be at least 20k - very little current will flow through the LED.
// LED should light dimly.
//May need to turn off room lights or cover with hands to see.
delay(1000); // Wait one second.
pinMode(2, INPUT); //Input mode turns off the pull up. No current to LED.
delay(1000);
}
Connect an LED to GPIO 2 (or use another pin and change the code to match) with the LED cathode connected to the Arduino ground.
It may be very dim. The built in pull up will be at least 20k, and may be as high as 200k depending on which processor is built in to your Arduino.
Information on "pinMode".
Information on Arduino pull ups.
The above is a trick, and may not work. I haven't tried it out.
Whether it works or not will depend on how efficient your LEDs are and which processor you use.
Try it out. It cannot hurt your processor or your LED.
Do not change the pin mode to output. That may damage your processor (though probably not.)
This is the same idea that Sadat Rafi had except using the Arduino library functions rather than generic Atmega code.
The same cautions about LED efficiency that I've given here apply to that answer as well.
Pin 13 was a poor choice on my part. It is used for other things on the Arduino.
I've changed the code to use GPIO 2, which shouldn't have any conflict.
Do NOT use GPIO 0, 1, or 13 with this trick.
Those pins are connected to other things on the Arduino board. Those other things could cause damage to the Arduino if there are LEDs attached, and will almost certainly interfere with normal operation of the Arduino.