44

I have just started experimenting with Serproxy and Arduino to get some serial data into Flash Builder/Flex. Serproxy seems to work fine and seems to connect to whatever port is specified. However, I am not able to see or read any data from the serial port using ActionScript. This is odd, because the Arduino should be printing data on a loop.

The only thing I can think of is that I am not setting the correct serial port number. I have been trying to figure out how to find out what number should be set, that is, 5331, 5332, 5333, etc.

How do I find out the port number? Is there a way to do this using Terminal on OS X maybe?

dsolimano
  • 8,870
  • 3
  • 48
  • 63
Bob-ob
  • 1,560
  • 4
  • 18
  • 34
  • Not sure about OSX but on other systems you can monitor the serial port by going to Tools->Serial Port Monitor in the Arduino IDE – Moog Sep 04 '12 at 09:04
  • Consider changing the title of this question to something that reflects the selected answer. Maybe "How to read a serial port on Mac OSX Terminal?" – Matthew Cordaro Feb 10 '17 at 22:38

7 Answers7

108

You can find your Arduino via Terminal with

 ls /dev/tty.*

then you can read that serial port using the screen command, like this

screen /dev/tty.[yourSerialPortName] [yourBaudRate]

for example:

screen /dev/tty.usbserial-A6004byf 9600
Sr.Richie
  • 5,680
  • 5
  • 38
  • 62
26

Try this: ioreg -p IOUSB -l -b | grep -E "@|PortNum|USB Serial Number"

Farhan
  • 1,445
  • 16
  • 24
Nadi Hassan
  • 500
  • 4
  • 10
  • 39
    This is very nice, but how is this translated into the name in `/dev/`? – Automatico Jul 08 '14 at 21:56
  • 2
    Any solution about this translation? – Davide Feb 15 '18 at 19:52
  • 1
    It seems doable manually, each port has a port number, and its parent, grandparent ... , each has a port number too. If you join the number together, you get a subset of your serial port. Not sure what is the best way to do it programmatically to parse the tree. – Deqing Jul 03 '18 at 03:13
3

I was able to screen using the device's name anyway so that wasn't the issue. I was actually just trying to find the port number, i.e. 5331, 5332 etc. I managed to find this by a trial and error process using an app called TCP2Serial from the app store on Mac OS X. It isn't free but that's fine as long as I know it works!

Worth the 99c :) http://itunes.apple.com/us/app/tcp2serial/id506186902?mt=12

Bob-ob
  • 1,560
  • 4
  • 18
  • 34
  • 1
    There are not so many port numbers? In my case you can easily see which is the port number for the arduino: `imac: username$ ls /dev/tty.* /dev/tty.Bluetooth-Modem /dev/tty.Bluetooth-PDA-Sync /dev/tty.usbserial-A4001sy9 ` – dimme Mar 01 '13 at 23:54
  • 1
    But what is the serial com port number? com1, com2, com8, etc? – jwilleke Nov 27 '13 at 14:48
2

mac os x don't use com numbers. you have to use something like 'ser:devicename' , 9600

Harm
  • 21
  • 1
0

While entering the serial port name into the code in arduino IDE, enter the whole port address i.e:

/dev/cu.usbmodem*

or

/dev/cu.UG-*

where the * is the port number.

And for the port number in case of mac just open terminal and type

ls /dev/*

and then search for the port that u have set in arduino IDE.

Peyman Mohamadpour
  • 17,954
  • 24
  • 89
  • 100
0

Let me share a much fun way for watching your serial port on Mac.

Step1: Run this command in your terminal with your device connected and then run with your device not connected ls /dev/tty.* . Which ever port appear/disappears, that one is the port you are wanting to work with For e.g /dev/tty.URT2 in my case.

Step2: Go to Mac App Store and install Termius. It is a really cool and aesthetic application for watching your ports and performing other types of experimentation.

Step3: Start Termius, Click on Hosts tab, then click on Serial button, then pick your Serial Port from the dropdown and select Baudrate.

Step4: Press Connect. Wollah, you are watching your port now.

Janzaib M Baloch
  • 1,305
  • 2
  • 5
  • 8
-1

Found the port esp32 was connected to by -

ls /dev/*

You would get a long list and you can find the port you need

Taha Ali
  • 457
  • 1
  • 5
  • 7