Digital Pin 0 and 1

Hello,

I need your help to understand something... Tell me if I'm wrong.

I can use PIN 0 and 1 as digital input/output referring to them was pins 14 to 18.

Is it a problem if I use USB to power on Arduino? Or I have to use a power supply?

For upload sketches (Only once in the beginning) is it possible anyway?

Thank you very much!

Hi,

Pins 0 and 1 are used by the USB port to upload your sketch. After the sketch is loaded, you can use them as digital pin. Just call them 0 and 1.

You can power your Arduino from USB if you don't draw more than what your computer can supply (around 500ma).

epi82:
use PIN 0 and 1 as digital input/output referring to them was pins 14 to 18.

jbellavance:
Just call them 0 and 1.

Pins 14 to 18 would firstly be 5 pins not 2, and secondly (on an Uno) pins 14-19 (not 18) are the analog pins aka pins A0-A5.

You refer to digital pins 0 and 1 as 0 and 1, not as anything else.

You can use them as inputs and/or outputs but you loose the ability of serial communication.

During an upload it's advisable to disconnect everything that is connected to those pins to prevent possibly upload issues.

You can use USB to power.

The above applies to a real Arduino; clones might differ.

Note that analog pins can be used as digital pins; it's preferable to keep pins 0 and 1 available for debugging purposes and use the analog pins if possible instead of 0 and 1.

If you always refer to the analog pins as A0, A1, A2 etc and the digital pins as 0, 1, 2 etc then there should be no confusion about which physical pins you are referring to.

I'm trying to connect to Arduino 10 push button.
Only for pins 0 and 1 (different from other pins used) the signal is always HIGH.

I don't understand why I can't use them is the same way...

What's wrong?

Thanks!

epi82:
What's wrong?

They may be in use by the serial interface: have you got the serial monitor in use?

(But in any case even if you haven't, you still need to disconnect other stuff from 0 and 1 for code upload.)

Are all your other digital pins occupied, including A0-A5 which in spite of being named Ax are actually digital unless you use analogRead().

I don't understand why I can't use them is the same way...

What's wrong?

Pins 0 and 1, because they are the hardware serial pins, have built-in pullup resistors. Depending on your circuit, you may, or may not, be able to use them as inputs for switches.

So, how ARE your switches wired?

If I use them as output for LEDs? Could be better?

Thanks!

epi82:
If I use them as output for LEDs? Could be better?

Thanks!

Be sure to let us know. You have the Arduino right there. Try it!

1 Like

epi82:
If I use them as output for LEDs? Could be better?

Thanks!

Don't use them at all. Even better.

Which Arduino board are you using and what is connected to the pins on it ?

I'm using Arduino One.
Now 2 pushbutton are connected but it doesn't work.
I will try with 2 led but I don't know if is the right way.
I need them... I haven't other pins free with Lcd display, 10 push button, 3 leds and 1 buzzer.

Thanks.

I need them

No, you don't. That's what multiplexer chips are for.

For your 10 pushbuttons, What if there was an other way? See this

Jacques

jbellavance:
For your 10 pushbuttons, What if there was an other way? See this

I recently bought one of these, very much like that, very handy. DFRobot's LCD shield uses a similar approach.

I can't take a multiplexer shield now... It's too late.
I need to know if there's a way to use pin 0 and 1 for 2 pushbuttons or leds using only Arduino board.

Thanks.

Just make sure that you unplug the pushbuttons before uploading your code. Just connect the switches to the pin and ground and intitialise your pins with:pinMode(0, INPUT_PULLUP)You should be fine. Don't try to use pulldown resistors.