Using serial without listening

So, I am communicating with my arduino uno R3 though echo in debian linux. This works great, and i can get stuff back (For debugging i sent the same command back to the computer).

All fine so far.

However, now I dont really need the debugging stuff back anymore, so I removed the parts that send stuff back, making the arduino just listen.
Stuff still works great as long as i use
cat /dev/ttyACM0 > ~/debug.txt

And the file is empty as you would expect since I dont really send stuff back anymore from the arduino.
However, if I dont listen and handle the serial port on the computer with the above command, i cant really send commands either. I mean I can, and the rx light still blinks on the arduino, but the arduino does not execute the commands. The problem is then solved by letting cat /dev/ttyACM0 > ~/debug.txt run.

I kind of dont know whats wrong here, I dont see the tx light blink on the arduino, so i dont think its the serial buffer being full (If thats even a thing on the arduino), so I'd really appreciate any help on this.

Can you post your sketch?
There might be a design flaw?

Sure score!

#include <RCSwitch.h>
#include <util/delay.h>

#define BIT_LENGHT 24
#define TRANSMIT_PIN 10

RCSwitch NEXA_Switch = RCSwitch();

String readString;

void setup() {
  while (!Serial) {;} // wait for serial port to connect. Needed for Leonardo only
  NEXA_Switch.enableTransmit(TRANSMIT_PIN);  // Using Pin #10

void loop() {
  while (Serial.available()) {
    delay(3);  //delay to allow buffer to fill
    if (Serial.available() >0) {
      char c =;  //gets one byte from serial buffer
      readString += c; //makes the string readString

  if (readString.length() >0) {
    unsigned long tmp=(unsigned long)atol(readString.c_str());
    //Serial.println(tmp); //see what was received
    NEXA_Switch.send(tmp , BIT_LENGHT);

The part that changes is
//Serial.println(tmp); //see what was received
And nither option works without cat /dev/ttyACM0

On the computer side, serial options are set with the stty command (Correct baudrate etc)

So I’ve been testing, and cat cat /dev/tty9 > /dev/ttyACM0 also works.
/dev/tty9 is not in use so its not sending anything to the ttyACM0, but it seems like it is keeping it alive.
I’ve also in my code put in extra time for the buffers to fill up and tried sending an extra char before the “real” code, which did not work without the cat /dev command running, although it did with with, so the code was sound:ish.

The theory i have is that the serial connection is not working properly without being in use, but I still dont understand how.

Use serialEvent() to read inputs commands (e.g.: blink the led on Arduino). Process your command to blink within loop(). If you have to blink your led asynchronously, you have to implement your blink routine without delays. You don't have to output messages from Arduino to your computer for blink routine.

I don't like serialEvent() because you have no control over when it triggers.

Using if (Serial.available() > 0) { allows you to decide when you deal with the incoming data.


Some more techniques such as interrupts and notifications may also be used in which case interrupt/notification handlers have to be written.