Question about receiving serial signals from Arduino

Hi guys;
I've very recently started working with Arduinos again, after many, many years break. Had the very first release of Arduino, now I'm using Uno Rev. 3 [SMD].

I am working with a very simple IR receiver / transmitter.
Everything is working as it should, I am receiving raw data and I'm decoding them just fine. I have the transmitter relaying the received data, and that also works perfectly.

However; I am thinking I wan't to implement a "trigger" of a command on my laptop (I'm developing on a MacBook Pro) when a certain "signal" is received via serial. This is where I'm failing so far... I am receiving the signals in all serial terminals, exactly as expected, but I can't seem to find a solution to have a received signal via serial, trigger a certain command. (For now I'm just wanting my laptop to trigger the built-in command: "say" which makes the OS speak the word / sentence specified.

I'm thinking a shell script running in the background (using screen or something) that monitors serial communication and issues: say "Signal detected" command.

I can't find a single instance online of how to trigger something on a received signal in screen? I can't even find information on how to send text / commands via serial using screen, like you can with the Serial Monitor in Arduino IDE.

Any help would be greatly appreciated!

Any serial terminal program can be used to communicate with the Arduino, just like the serial monitor.

As for monitoring a particular serial stream and looking for keywords, you need a process of some sort running on the laptop.

Theoretically, yes, but it seems like the Terminal app screen (MacOS / Linux / etc) doesn't send, it only receives :thinking:

I'm trying to figure out how to script a bash script that uses screen app to monitor serial comms and then trigger a command, but so far no luck what so ever...

I rarely use Macs, but I can't imagine a terminal program that is receive only.

How would you know? You have to have a program running on the Arduino to tell if characters are being received.

I use 99.9% Mac.
I am almost completely sure about screen. When I use Serial Monitor in Arduino IDE to send a "command", it does what it is supposed to on the Arduino. Running it using screen, nothing happens. It just simply doesn't send anything.

Have searched for hours today, and every page I find states that screen is RX...

What is "screen"? I'm talking about a serial port terminal emulator program. e.g. Serial

Screen is just that; A serial port emulator that’s built in to MacOS

Well, either it is defective, useless, or you are using it incorrectly.

In addition to Serial, there is also CoolTerm and Pros.

You haven't answered this question:

How would you know? You have to have a program running on the Arduino to tell if characters are being received.

I asked Mr. Google about Macos and screen and he didn't know anything about such a feature.

You haven't answered this question:

Yes, I did. I said I have an Arduino running as an ir to/rx and that it receives and runs the expected code when receivnig via Serial Monitor from Arduini.cc

So it is tested and working via that. Å

If "screen" is receive only, it is not a serial port terminal emulator. You are wasting everyone's time, especially your own.

I'm out, so good luck with your project!

One instance talkng it over

It's a command to the CLI, not an app and it is certainly bidirectional although it may be lame compared to a genuine terminal emulator it isn't that dumb.

a7

Maybe this can be adapted to the Mac OS
Power Sessions with Screen | Linux Journal

Essentially you must utilize a control character.

Sure it does (just tested it!)
I'm not sure that the "sharing" aspect of screen is going to play nice with USB ttys, and I see some other odd behaviors, but my simple echo sketch works fine with screen as invoked:

screen /dev/tty.usbserial-A20e1Kh4 115200
void setup()
{
  Serial.begin(115200);
}
void loop()
{
  int c = Serial.read();
  
  if (c != -1) {
    Serial.println(c);
  }
}

Did you close down the Serial Monitor and Arduino IDE while using screen?

Yes. Were you expecting Screen and the Serial Monitor to both be able to talk to the same serial port? I doubt that that will work - it requires BOTH of the programs talking to the Serial port to be aware of the sharing, and I'm pretty sure that the Serial Monitor isn't.

I'm not really aware of any Serial com programs that let you "trigger" other apps based on data sent by a serial device. Other than the standard unix shells, anyway. Such a thing would normally be considered a huge secuity hole, I think.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.