Can I use pin 0 and still get messages on serial monitor?

I've read that I can't use Nano pins 1 and 0 if I also want my sketch to use serial but what if I only want to use pin 0 (which is meant for the Arduino to receive serial data) and transmit data from the Arduino to the serial monitor? Does the Arduino still need to receive data from my PC even if I only want the communication that goes in the other direction?

Couldn't serial.begin(9600) do some sort of handshake and then my PC shuts up and just listens to pin 1? Then I could put a button input on pin 0 and still do my debugging.

What is the reason behind this? Are you out of I/O? Including the analog pins?

Yes, every last pin has been assigned. The analogue pins are for four thermistors and four current sensor chips. I need SPI (COPI only) pins plus three digital pins for the display, four digital pins for MOSFETs, three digital for three buttons and one PWM for a piezo.

I believe you can use the 0 pin as normal, but not the 1 pin.

Thanks; I hope you're right.

pinMode( 0, INPUT_PULLUP); Serial.begin(115200);

I just did a quick test with a push button connected to pin 0 and ground with these lines in setup.

Code appears to download with this configuration, the button works as expected, and printing to the serial monitor is normal.

Problems may occur when pin0 is connected to something else, if it powered, or an output, or overrides the ability of the USB download to toggle the pin, but with what you want to do, it appears to work OK.

1 Like

Thanks. I was thinking I should put a resistor, maybe 510 ohms, between the switch and ground just in case it is pressed when I upload a sketch or something. I think that would probably never actually happen but maybe it's appropriate just in case.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.