0

I am trying to read serial port data generated by Arduino in Octave on Mac. I installed and loaded the instrument-control package for the same. I used this piece of code to check if the package was installed properly

if (exist("serial") == 3) disp("Serial: Supported") else disp("Serial: Unsupported") endif

I do get an output saying Serial: Supported.

I am following the tutorial here for step by step guidance. I next use s=serial('portname') to create a serial port object. However, I am not sure what name to use instead of COM5 on Windows for Mac.

I checked and my Arduino is connected to cu.usbmodem1421 so I tried following 3 options a)cu.usbmodem1421 b) usbmodem1421 c)1421 but in each case I get an error saying "serial: Error opening the interface: No such file or directory".

Could anyone tell me what port name I can use or if there are any suggestions for the big picture problem as to how to read Arduino serial data in Octave (on Mac)? Thanks for the help in advance.

1

You most likely need the full canonical pathname for the port:

/dev/cu.usbmodem1421

On the Mac, as in Linux and other Unix derivatives, most devices, serial ports included, are special files in the /dev directory.

  • Thanks for the suggestion. I tried /dev/tty.usbmodem1421 and it worked! – beeprogrammer Apr 22 '17 at 18:08
  • According to the rules of TTY naming for connecting to an external device from inside the Mac you should use the /dev/cu.* variant. It's the same physical devices as the /dev/tty.* variant, but the line control is handled differently. The /dev/tty.* variant is intended for incoming connections to the Mac (a text-based login prompt). – Majenko Apr 22 '17 at 18:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.