3

I have a problem with TTY device on MAC. I created a script which talks to Arduino and works well on Linux. Problem I'm having with MAC is I can't "fopen" the device. For example, if I do

echo "foo" > /dev/tty.usbmodem1431

It hangs forever blocking the port. It works well from Arduino's Serial Monitor so theoretically I should be able talking to it.

OK. I found the solution. I have to write to

/dev/cu.usbmodem1431

I still don't know why TTY don't want to work.

Lukasz Kujawa
  • 3,026
  • 1
  • 28
  • 43

2 Answers2

2

You can use tty with:

stty -f /dev/tty.usbmodem1431 cs8 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

echo "hello" > /dev/tty.usbmodem1431

Where 115200 is your Serial.begin speed.

1

What speed are you using? The default speed of Max OSX is 9600. Give it a try (when you set serial in your arduino program). stty does not seem to change the speed as one would expect.

user1139880
  • 1,828
  • 3
  • 18
  • 27