I am trying to interface with some hardware that requires me to use half-duplex serial. What is the best way for me to implement this?
I am using a Teensy 2.0, if this precludes me from using certain libraries.
EDIT:
I found a good library for this.
It's called SoftwareSerialWithHalfDuplex. Seems to work pretty well.
Alternatively, I'm thinking maybe I could have just tied together the UART RX and TX and set the TX pin to input mode most of the time, but I don't know if I can do that.
Both. I want bi-directional half-duplex. I need to be able to read serial data, set the pin to output mode, send serial data, and put the pin back into input mode.
I would prefer a hardware solution, but software serial should be OK as well.
It's called SoftwareSerialWithHalfDuplex. Seems to work pretty well.
Alternatively, I'm thinking maybe I could have just tied together the UART RX and TX and set the TX pin to input mode most of the time, but I don't know if I can do that.
Hey there,
I wrote that library...well, mostly just adapted the SoftwareSerial library. Anyways, all it does is what you suggest in your alternative.
Cheers