Pins 1 and 2

If part of my program is serial communication to a pc, can i use pins 1 and 2 for anything?

If part of my program is serial communication to a pc, can i use pins 1 and 2 for anything?

That probably should be worded-- If part of my program is using serial communication to a pc, can i use pins 0 and 1 for anything else?

And if that corrected question is what you are asking, then No, you cannot use those pins for other purposes if you are using them for serial communications.

Lefty

Rob311,

If you wanted to use a serial conection to other hardware, you would end up doing is using the SoftwareSerial library to use 2 other pins as your serial port.

Pins 0 and 1 are connected to the USB port on the board and will be left to communicate with the computer.

In theory, you could do this if you had a custom arduino board, and gave up a pin to signal a "latching buffer" chip to route the pins 1 and 0 to either the serial interface, or as gpio. The fact that you would need a pin for this kinda doesn't gain you much, but it is certainly possible.

To repeat Photo-Worx's answer in a slightly different form....

It is Just Easier to leave pins 0 and 1 dedicated to the Arduino's communications with the IDE... the software we use to put out programs into the Arduino. That happens to travel as serial data.

If you want to connect ANOTHER serial device, it is easy... if you dedicate two more pins to that task.

An example is given at...

http://sheepdogguides.com/arduino/art8lcd117.htm

... where an LCD panel controller receives serial data from an Arduino. (In the example, there is no serial input to the Arduino, but the channel for that is set up, even though it isn't used.)