Question about pin13 (when not using it)

Hello,

I'm new to Arduino and I have got a question about Pin13.
As you can see in the sketch, I changed Pin13 to Pin3.
After about 30 sec the Pin13 led lights up 3 short times and the sketch starts again.
I don't understand why Pin13 activates after a sketch.
The led on pin3 works fine like in the sketch.

So my question is, why does the led on Pin13 light up even though it is not in the setup?

void setup() {                
  // initialize the digital pin as an output.
  pinMode(3, OUTPUT);     
}

void loop() {
  digitalWrite(3, HIGH);   // set the LED on
  delay(1000);              // wait for a second
  digitalWrite(3, LOW);    // set the LED off
  delay(250);              // wait for a second
}

Hope somebody has a good answer, I´v been searching on the internet why it happens but have not found anything.

So it sounds like your arduino undergoing a periodic reset condition. This can happen if the power source is dipping to low. Just a guess but did you fail to use a current limiting resistor for your LED wired to pin 3? If so that is very bad and can damage the digital output pin.

What power source are you using to run the board?

Lefty

Resets also occur anytime the Arduino's serial port is opened or closed.

There could be software on your PC that is "scanning" for Serial Ports. This behavior will cause the Arduino to reset. Often, software associated with cellular-broadband adapters do this type of scanning.

Well I did have had it running without a resistor, I will watch out with that, I don´t want to blow up any ports.
The only powersource I used is a USB cable.
Lefty, do you think I already damaged the board?
I don't know if there is software "scanning" for ports, how can I disable that kind of software?

do you think I already damaged the board?

Yes defiantly.
But it might still function for a time. Try another pin, get it working and then try PIN 3 again to see if it still functions.

Then read:-
http://www.thebox.myzen.co.uk/Tutorial/LEDs.html
To find out why you need a resistor.

Lefty, do you think I already damaged the board?

I can't tell from here. Get a properly size resistor wired to the LED and test with pin 3 and see if it blinks as it should.

Lefty

I solder a 200 ohm resistor on it, it blinks the same (less bright ofcourse.).
A shame that I forgot to solder the resistor.
my board keeps the reset after about 30 sec even on different digital pins.
Is there some way to see if the serial port is open/close? (because of the reset)
I also want to thank you guys for the support!

Smokoo:
Is there some way to see if the serial port is open/close? (because of the reset)

Don't power the board from your computer. Do you have a USB "charger" that plugs into the wall and provides a USB port? If so, check that its output is 5V and use that to power the Arduino.

Otherwise, you'll have to look through all of the processes running on your computer and determine if any of them might be checking the serial ports.

Put your finger on the 328p chip, does it feel hot?

Lefty

I used a Iphone charger and it doesn't reset now (checked the 5V).
There must be a program that is scanning those com ports like you guys suggested.
I will try and locate the program because the charger is not my property.
That means I isolated the problem and traced it back to the pc, Arduino works correct without the pc.
If PIN3 still funtions correct, will that mean the damge is not severe?

If PIN3 still funtions correct, will that mean the damge is not severe?

There's no way to know - you've already stressed the transistors beyond their maximum ratings so they are probably performing poorly and may deteriorate with time. Failure can occur with that pin or nearby stuff on the chip at any point really - the longer it survives the more likely it is to keep going - and avoid stressing that pin again (derate it to logic only perhaps?)

Thanks for the information, The only thing I don't understand is "derate it to logic"
It means I have to use it for sending a logic signal but not "power" something, that way?

Smokoo:
If PIN3 still funtions correct, will that mean the damge is not severe?

These mcus can take a fair amount of abuse, and having a LED connected without a series resistor isn't as bad as a direct short to ground, which is what I did once - and got away with. So I don't think you need to worry about your mcu, unless you intend to use it in a situation in which reliability is paramount.

The only thing I don't understand is "derate it to logic"

He means only use it for low current outputs like driving other logic chips, or using it as an input.

Derating is reducing the rating of a device so if the pin can normally supply say 30mA you would derate it by 50% by making sure you only used it at 15mA or below. Derating is used to extend the life time of a component.