I want to use a micro-controller to send data through a max232 that will convert the 0v/5v signals into -12/+12v signals. The problem with this IC is that when there's no signal, it sends a +12v signal which I don't want. I want to be able to control exactly when to send a signal. So I would like to use a transistor (or something else) to make an electronic switch and connect an additional pin of my micro-controller to open and close the switch when I need to. I've made a diagram so it makes more sense. This diagram is an idea I've had, but I don't know how to make it work, I read the data-sheet of the 2n2222 transistor and seems like negative current won't go through.
Here's the Schema simplified : Basically, it sends the data to the receiver when and only when the Switch is turned on, the rest of the time, the switch is off and no data transit. I'm just looking for an electronic equivalent of that switch that I could control with a microcontroller.