Pin:13 problem <arduino pro mini 5v>

Hi

in one recent experimental project i had to use most of the pins of Arduino pro mini..

i used all the I/O pins and Analog also (used them as I/O)

Half of them used them as I/O inputs (INPUT_PULLUP) and the other half as OUTPUT to drive led diodes

the concept was to push each button and turn on the led (easy task for a begginer )

i used the Pin : 13 as input

while i was using the arduino pro mini conected with the usb cable to read and serial monitor also.. everything worked fine

when disconnected the cable and used an external power supply something weird happened.

Led that supposed to be opened by Pin13 was always on..
the same when i had the external power supply on and connected the usb cable.
the serial print was giving me the message that pin13 was active (like i was pressing the button)

button switches and all connections was checked more than one time and were fine.

so at the end i used the last spare pin that i had (A3=17) and moved the the button there

after that everything worked fine with or without external power supply

i guess that something has to do with the pin13 that has by default the led in the Arduino board

So the question is :

if i want to use pin13 as input in the future is any special command that have to place in my code in order to use it ?

Thanks in Advance

if i want to use pin13 as input in the future is any special command that have to place in my code in order to use it ?

No.

But, pin 13 has a built in resistor, so using it as an output pin is far better. Whatever is being input to pin 13 has to overcome the resistor built in.

Thanks :slight_smile:

So i will have it in my mind for the future... use it most of the times as output

The Pro Mini, like some early Arduino models, just has a current limiting resistor and an LED between Pin 13 and Ground. The UNO and MEGA models put a op-amp between Pin 13 and the LED so they don't put any significant load on the pin.

Thanks for extra info... so based the model i will use for my projects i will have that in my mind...