problem with L-LED arduino Uno

i have trouble with the onboard L-LED, which belongs to pin 13.

when i link the USB-cable with the Arduino uno board on my pc, the L-LED turns on constantly.
Usually it ought to be off all time . What's wrong with it?

Nothing wrong, probably. In a new Arduino the LED is normally blinking, but if you uploaded a sketch the LED will be in the state set by the last sketch that changed the value of pin 13. This, at least, is how it works for me. My understanding is that the values of the I/O registers are preserved during a power down, but I didn't check the documentation.

How is the rest of your board working? Can you upload a sketch, turn the LED off, make it blink?

const int led = 13;

void setup()
{
pinMode(led, OUTPUT);
}

void loop()
{
digitalWrite(led,LOW);
}

after i've upload this sketch, the L-LED turns off. Or if i put a LED in Pin 13 and Ground, then the onboard L-LED turns off too.

look at this guy http://www.youtube.com/watch?v=RGRhIQneO6w starting 11:25

he turns on the L-LED on by a button in labview.First the L-LED is off. Then when he press the boolean button the L-LED lights on.
And when he press again the button, the L-LED turns off.

But on my board the L-LED is already on, although i don't press the boolean button. That's the error.

Are you using Labview in your test..?

The logic of the sketch is not right actually.

void loop()
{
digitalWrite(led,LOW); // the led is in OFF state
}

You havent told the microcontroller to lit the led at all. Try the BLINK example first.
:slight_smile:

yes labview2011 thanks for your helps.

now i find out the mistake...it was the wrong COM

On my pc the arduino board is COM3. But before this project I worked with a bluetooth module stacked on the arduino board.
This bluetooth module was the COM6 on my pc...

best wishes

spatula:
Nothing wrong, probably. In a new Arduino the LED is normally blinking, but if you uploaded a sketch the LED will be in the state set by the last sketch that changed the value of pin 13. This, at least, is how it works for me. My understanding is that the values of the I/O registers are preserved during a power down, but I didn't check the documentation.

Your understanding is incorrect, there is no saved register values during a power off/on cycle. All I/O pins default to input mode when reset or power cycled.

How is the rest of your board working? Can you upload a sketch, turn the LED off, make it blink?

The new R3 Uno and Mega board changed the method to drive the pin 13 led/resistor assembly from direct drive from the output pin to driving it via a op-amp stage. And this op-amp stage will have a floating input pin condition unless the pin is set to output mode and a LOW output command is executed. So if you have no pin 13 commands in your sketch the state of the pin 13 LED is undefined. It's simply a product of unintended consequences of the change in hardware design for the Uno and Mega Rev3 designs. If you wire a 50K ohm resistor from pin 13 shield connector and ground that behaviour should go away.
Lefty