Software serial with rx pin only

Hi

Currently im on small project which includes RFID reader. Reader is ready module communicating with arduino by serial interface. Reader is not configurable in any way so im only reading from it. Because of much pin-eating elements in project (like LCD) i have to think twice on each pin usage.

So, is there a way to use SoftwareSerial with only rx pin?

My board is Arduino Leonardo.

Yes, there is. Specify a non-existing pin number for the TX pin and it will be disabled.

Please note that on the Leonardo you cannot use all pins as SoftwareSerial RX pins:

Not all pins on the Leonardo support change interrupts, so only the following can be used for RX: 8, 9, 10, 11, 14 (MISO), 15 (SCK), 16 (MOSI).

pylon:
Yes, there is. Specify a non-existing pin number for the TX pin and it will be disabled.

So if i use for example:

SoftwareSerial mySerial(8, 99);

It will be ok?

You could look in the playground at shift registers often used to extend the number of pins or one of the other I?O expansion methods

Mark

ndd12: So if i use for example:

SoftwareSerial mySerial(8, 99);

It will be ok?

It's probably OK, although it isn't completely correct because the code does a few things the may end in strange behavior. I just checked the code and in your case (TX not needed) it's better to use this:

SoftwareSerial mySerial(8,8);

The TX pin is initialized before the RX pin, so the complete initialization of the TX pin will be overwritten before the object gets into use. Whatever initialization method you use, you'll probably get unexpected behaviour if you ever go to write to such an object.