Trying to use digital input 0 & 1 as button inputs - unsucsesfully

Hello people

I went through the forum and read that you can't use digital pins 0 & 1 as inputs or outputs if your using serial communication i.e. serial begin. Now I'm trying to use it as button inputs but it is not working, I'm not using serial print and my wiring is the same as in the arduino button example of here:

If I move my button inputs to digital pins 2 & 3 it is working like a charm but on 0 & 1 it just won't budge. With the project I'm currently working on the only available pins are digital pins 0 & 1, the rest are all used and I want to move the buttons located at 2 & 3 to 0 & 1 so that I can use the PWM output at pin 3 and use pin 2 to switch something on and off.

When I connect my buttons inputs to pins 0 & 1 and I press one of the buttons then the TX led lights up, I don't know if this might be a clue. Any input would be greatly appreciated. Thank you very much. :fearful:

Confirm you're not calling Serial.begin()?

Post your code and we might be able to offer better answers.


You can't use that external pull-down resistor on pin 0 because there is a de facto pull-up resistor already on pin 0 from the USB serial converter chip. If you wish to use a button on pin 0 just wire it from ground to pin 0 and a digitalRead LOW will mean the button is being pressed and a reading of HIGH will mean it's not being pressed. Pin 1 can use a pull-down resistor if you wish but it's simpler to just enable the internal pull-up resistor and wire the button between pin 1 and ground and have it return the same values as pin 0 would do.


@ Billroy

No I'm not calling Serial.Begin()

@ Retrolefty

Thanks for the feedback I will try that, just one question. Is there a specific piece of code that I must use to enable the internal pull-up resistor or is it enabled by default?

Thanks for the feedback gents Dirk

You can do it by setting pinMode to INPUT_PULLUP like this

pinMode(1, INPUT_PULLUP);

You can also do it by just setting your input pin HIGH

digitalWrite(1, HIGH);

This was the way to do it in older versions.

Hello Perhof

Yes I just came across that piece of code. Thanks for sharing, but it turned out that I didn't have to enable the internal pull-up resistor on digital I/O pin 1. I also connected it the same way as described by Retrolefty and it's working splendidly. Now I've got my PWM output pin open with an additional I/O pin. Thanks everyone for the input and I hope that each one of you will enjoy a wonderful day.