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:
cat /dev/tty.usbmodem1d112
< This returns absolutely nothingscreen /dev/tty.usbmodem1d112
< This Prints output, but has problems with input.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.
stty
toraw
mode or whatever I want first, but I'm not sure how portable that is.screen /dev/SomeUSBSerial SerialSpeed
works fine here on Debian with CP2102, FTDI232, Atmega32u4 (Leonardo), Atmega8U2 (serial chip of UNO-R2)... input and output are ok.cat
uses the argument as the file to display. In the 2nd, the shell sets the standard input forcat
to the file. The net result of both is thatcat
reads from the file and writes to standard output. The < and > operators are used to redirect the input and output of a program.