How can we run external program over Arduino

I've made a CLI app for macOS and I can run that program in terminal. And I want to run it from Arduino. How can I do that?

Can the CLI app app accept serial input ?

UKHeliBob:
Can the CLI app app accept serial input ?

I don't know serial input's mean :frowning: I'm writing this app with Swift in Xcode. I'm just running that app in terminal like mac@mac:~ $ appName -parameter. But if I can achieve to accept serial input so how can I run it from Arduino? Is there any library or something else?

ozgrozer:
I don't know serial input's mean

Then your first task is to ask Google to help you remedy that deficiency.

Most Arduinos cannot cause anything to happen on a PC unless there is a program running on the PC and listening for the output from the Arduino.

However a Leonardo or Micro (which use the 32U4 MCU) can act as a keyboard or mouse and in that mode they may be able to cause things to happen on the PC.

...R

Robin2:
Then your first task is to ask Google to help you remedy that deficiency.

Most Arduinos cannot cause anything to happen on a PC unless there is a program running on the PC and listening for the output from the Arduino.

However a Leonardo or Micro (which use the 32U4 MCU) can act as a keyboard or mouse and in that mode they may be able to cause things to happen on the PC.

...R

I got it. I've found a way. Here's the link for other people.
And now what's the next step? How can I send a signal from Arduino to this app? What's the magic code?

Update:
I think I understand. Now I'm just sending commands from Arduino like Serial.print("command"); :slight_smile:

If your swift program is listening on the right serial port, then you got it - the Serial.print() or Serial.println() or Serial.write() will send data on the serial line and you can pick those up on the Mac side. Similarity writing in the stream connected to the Serial driver on the Mac side will send the data back to your Arduino

There is a package you can look at for Swift GitHub - armadsen/ORSSerialPort: Serial port library for Objective-C and Swift macOS apps

Be aware that when using most Arduino boards opening the serial port resets the Arduino which is not what you want to do in most cases.

Or is a good way to start the program on the computer knowing that the arduino is freshly booted :slight_smile:

Just need to be taken in account indeed and not closing that port by mistake