Can any pins be used for serial communication or can only the tx and rx pins be used?
Can any pins be used for serial communication or can only the tx and rx pins be used?
It depends. The AVR 168/328 chips have but one 'hardware USART' internally and the Arduino core library supports this via pins 0 and 1. However with a proper software library on can emulate a USART in software supporting any pair of digital I/O pins. There are certain advantages to using the hardware serial interface Vs software but it depends on your application if that would effect anything you are trying to hook up or not.
Here is one popular user contributed software serial library:
http://arduiniana.org/libraries/newsoftserial/
Lefty
Thanks, I am uding the mega so it has 3 rx tx pins I believe, but the software serial may help out alot.
Thanks, I am uding the mega so it has 3 rx tx pins I believe, but the software serial may help out alot.
Actually the Mega board (AVR mega1280 based) has four hardware serial ports.
Good luck.
Lefty