Skip to main content
Arduino

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

Required fields*

Use Unix terminal instead of the Monitor on Arduino IDE

I want to make a shell or C script that interprets the Arduino serial input to run commands. For that, I will need to make that script be the Serial monitor for my arduino. Another reason I want to use scripts or the command line as a Serial I/O is because the Arduino monitor function freezes the IDE.

My arduino's serial port is /dev/tty.usbmodem1d112

This is what I have tried so far:

  1. cat /dev/tty.usbmodem1d112 < This returns absolutely nothing

  2. screen /dev/tty.usbmodem1d112 < This Prints output, but has problems with input.

  3. cat < /dev/tty.usbmodem1d112 < Same result as cat without the < symbol.

Sometimes, I also get annoying Resource Busy messages. This makes me re-plug the Arduino board.


OS X (10.9.5) Arduino IDE latest version. Arduino M0 pro board.

Answer*

Draft saved
Draft discarded
Cancel
7
  • Strangely, running the stty -g < /dev/... acts like the command is running, but nothing happened for long. When I use the second command to make a shell script, upon execution, it freezes my Terminal command line. Commented Dec 26, 2015 at 9:04
  • Can you show the output you get from stty -g...? Are you running the command with -f and/or sudo? I'm very puzzled that the second command, chmod, would hang your shell – it should succeed (or fail) immediately. Commented Dec 26, 2015 at 14:18
  • chmod was fine. The long command creating shell script works, but the execution of the sh hangs shell. I did try sudo, and -f, but it shows new line as if processing, but nothing seems to happen Commented Dec 26, 2015 at 14:29
  • When you say "nothing seems to happen" do you mean the command produces no output and you get your prompt back? Or, the prompt doesn't come back until you interrupt the command? Or, it appears to execute as you'd expect by the settings on the serial line are unchanged? Or,... Too many possible nothings :-) Commented Dec 27, 2015 at 20:39
  • 1
    Would you try ./stty.arduino < /dev/tty.usbmodem1d112 and see if that works? Looking this over, I see that the command to condition the line doesn't specify the line – so it's going to act on your terminal, and that's almost certainly not what you want. Commented Dec 27, 2015 at 20:46

AltStyle によって変換されたページ (->オリジナル) /