Software serial TX on the UNO's RX pin

Can you set up software serial Tx on pin 0 of the uno?

To explain, I have SparkFuns lcd kit, connected to my main board with just the kits RX pin. But I want to use some of the additional pins to check a toggle switch (every few seconds or so). So I'm hoping to be able to end the hardware serial, start the soft-serial on the same pin 0, and send the switch state back to my main board. I have my main board send a specific char to let the lcd kit/board know it's switching from send to receive mode.

Of all the pins on the Arduino, why are you choosing the most difficult one?

Have you tried it? What happened?

My guess is that you will screw up the Hardware serial receiving everytime you switch it off.

...R

Ok, I only have the 1 signal wire between the LCD kit and my main board, but I realized, I can switch it to another one of the available digital pins, so I’m using pin 11.
But I’m not having much luck getting things working out to switch it from Rx to Tx on that line. Here’s an example code of what I wrote that I thought would work. The main board send a counter to the LCD. which the LCD side prints out on the LCD itself. Once it get to 5, it send the $ sign, and the LCD board then switches to transmit mode, and sends back the text ‘hello’. This all works. But then the LCD doesn’t seem to be switching back to receive mode after that.

This runs on the LCD kit:

#include <LiquidCrystal.h>
#include <SoftwareSerial.h>

char inKey;  // Character received from serial input

// initialize the LCD at pins defined above
LiquidCrystal lcd(2, 3, 4, 5, 6, 7, 8);

SoftwareSerial RxSerial(11, 10); // RX, TX - receive on pin 11

void setup() {
  Serial.begin(9600); //debugging
  RxSerial.begin(9600); //RX in from main board
  lcd.begin(16, 2);  //Start LCD
  pinMode(9, OUTPUT);  //Backlight pin
  analogWrite(9, 255); //Turn on backlight
  Serial.println("Testing Serial");
  lcd.clear();
}

void loop() {
  while (RxSerial.available() > 0) { //rx from main board
    inKey = RxSerial.read(); //read character
    // Check for special LCD command
    if (inKey == '1') lcd.clear();
    if (inKey == '

and this runs on the main board:

#include <SoftwareSerial.h>

SoftwareSerial TxSerial(10, 5); //transit on pin 5

int TxData; //something to transmit

void setup() {
  Serial.begin(9600); //debugging
  TxSerial.begin(9600);
}

void loop() {
  delay(1000);
  Serial.println(TxData); //debug
  TxSerial.print(TxData); //send the value
  TxData += 1;
  if (TxData == 10) { //time to receive something
    TxSerial.print("$"); //send the value
    TxData = 0; //reset counter
    delay(500);
    TxSerial.end(); //end Serial
    SoftwareSerial RxSerial(5, 10); //receive on pin 5
    RxSerial.begin(9600);
    unsigned long RxWait = 3000; //amount of time to wait for RX
    unsigned long RxMillis = millis(); //start time
    while (millis() - RxMillis < RxWait) {
      if (RxSerial.available()) {
        byte reading = RxSerial.read(); //data from LCD
        Serial.println((char)reading);
      }
    }
    SoftwareSerial TxSerial(10, 5); //transmit on pin 5
    TxSerial.begin(9600);
    Serial.println("Starting TxSerial again");
  }
}

) {
      lcd.write(inKey);
      sendTX(); //$ is the special code to switch to TX mode
    } else {
      lcd.write(inKey);
      Serial.println(inKey);
    }
  }
}

void sendTX() {
  RxSerial.end(); //don’t know if this does anything?
  delay(500); //give the main board to to switch to receive mode
  SoftwareSerial TxSerial(10, 11); //send on pin 11
  TxSerial.begin(9600); //begin TX mode
  delay(100);
  TxSerial.print(“HELLO”); //send test string
  delay(500); //give serial time to send?
  TxSerial.end();
  SoftwareSerial RxSerial(11, 10); //receive on pin 11
  RxSerial.begin(9600);
  lcd.clear();
}


and this runs on the main board:

§DISCOURSE_HOISTED_CODE_1§

quick edit: If anyone knows of an example somewhere where serial is switched back and forth on one wire, I’d like to see how it’s really supposed to be done. What I’ve done was just a shot in the dark.

If you have two pins free (5 and 10), why are you trying to switch which is the transmit pin? If you don't need to receive, you can use a non-existent pin number for the receive pin.

Creating a new instance of SoftwareSerial in loop is a bad idea.