How to display data on Terminal?

I am working on a temperature measuring project. I already flashed the firmware to the Electron successfully but having trouble to see the data it gathered on Terminal.

After flashed the code, I ran the command ls /dev/tty.*, found the serial port, then screen /dev/tty.usbserial-A700eWEe 9600. First time Terminal generated a “1.screen” window and I could see all the data that printed out! Yay! But then I closed the Terminal, plugged out the Electron, and ran the same commands again (flash codes -> screen the data) but it didn’t work! The error was “Couldn’t find PTY”. I tried to look up online but nothing helpful. I’ve been stumped for hours. Does anyone know what’s going on? Thank you for your help in advance!

I am using Macbook (Sierra, Version 10.12.1) and iTerm2 (Build 3.0.15).


The data is via USB from Electron using a serial port. If you plug it out then there’s no way to get data from the Electron?


I don’t think even MacBook supports wireless USB yet :wink:

1 Like

Hi @kennethlimcp @ScruffR thank y’all for the reply!!

Sorry I forgot to mention I plugged them back on haha. I plugged them out to turn them off, then plugged them back, flashed the code again, ran the two commands to find the serial port and screen again, like how I did the first time! But could never see the data from Terminal again T-T

BTW this is my forth day learning particle and first time posting my question and already feeling the love from the particle community! Thank you! You guys are lit!!

1 Like

Shouldn’t you be using /dev/cu.usbmodem*?
That’s how it shows up on every Mac I’ve used Particle with.

I see that /dev/tty.usbmodem* shows up as well like you mentioned, but try using /dev/cu.usbmodem*


Using the Mac built in Terminal program, I sometimes get an error of “Sorry, could not find a PTY”. This happens if the Photon is already running, and plugged into USB before I launch the Terminal window and send the screen /dev/tty.usbserial* command. If I launch the Terminal window first, restart the Photon (or reset it), then send the screen command, it does find the PTY.

@nrobinson2000, I’ve always used /dev/tty.usbserial* on my iMac (Sierra10.12.6 and older versions), but /dev/cu.usbserial* also works for me.

1 Like

Using the Particle CLI, my favorite in Terminal is just to do:

particle serial monitor --follow

If you hit the reset, it will automatically reconnect and continue displaying output.

The only drawback with this is do not disconnect the USB before control-C’ing out of this command. It will lock up the Terminal. If you do, you can plug it back in and then Ctrl-C. If you need to force it to shutdown, you will have to put it into the background Ctrl-Z and then kill the background process. Usually: kill -9 %1

%1 being the 1st background job. You can find out using the jobs command.


Thank you @nrobinson2000 @Ric and @cermak !! THANK YOU!

It is displaying data on 1.screen on iTerm right now but I am having trouble to kill it - control-c doesn’t work, and I can’t even type anything. I also tried what @cermak said and whatever I googled but the thing is I can’t type D:::

How can I kill the process on 1.screen window without closing Terminal, and get back to the 1.bash window? Thank you!!

Oh! You are trying to do two way communication :slight_smile:

screen basics:

control-a begins the command sequence in screen

Next character:

  • d - disconnect from session
  • k - terminate session

If you disconnect, you can reconnect using screen -r

Thank you!! I control-a’ed in screen but it said “No other window”, and continued displaying data. What’s wrong?

That is if you hit Control-A followed by an “a”. If you want to kill that session, use Control-A then “k”.

Woaaaaahh it works!!! Thank you @cermak :DDDD

1 Like

Thanks for mentioning this. I’ve added it to my Particle tab completion.

1 Like

@manlin - I am not sure if you actually wanted to send information to your device. I tried a few different screen options and could not get the automatic CR/LF working properly when you pressed return/enter on the Mac. I had to build it into the code.

There is timer in there to produce output every 15 seconds on top of being just echoing the characters back to the screen. The “>” is not necessary, but I needed to determine if the echo was actually coming from the Serial and not being produced by screen.

Sample code:

 * Project twoWaySerial
 * Description: Test two way communication using Serial interface
 *    and screen in MacOSX.
 * Author: Rob Cermak
 * Date: 2017-10-11

void print_counter()
  static int count = 0;

Timer timer(15000, print_counter);

// setup() runs once, when the device is first turned on.
void setup() {
  // Put initialization like pinMode and begin functions here.



// loop() runs over and over again, as quickly as it can execute.
void loop() {
  // The core of your code will likely live here.


// Read input from the Serial port, you will
// need to add more code to actually perform
// an action based on provided input.
// Right now, everything read here will be
// echo'ed back to you.
void serialEvent()
  char c =;
  if (c == 13) {
    // When using screen, we have to convert CR to CR/LF
  } else {

Screen command (match the baud rate and determine the serial port):

$ particle serial list
Found 1 device connected via serial:
/dev/cu.usbmodem1421 - Photon

$ screen /dev/cu.usbmodem1421 9600

Sample output in screen:

>T>h>i>s> >w>o>r>k>s> >w>e>l>l> >n>o>w>.
>W>e> >w>i>l>l> >l>e>t> >t>i>m>e> >t>i>c>k> >b>y> >t>o>o>.

Hi, I am. working on the same exact project, could we compare notes?

My only additional item is a gyro and accelerometer to measure water movement.

Hi @johnflores619, I am working on a project for my professor. It is confidential so I am afraid I can’t share the codes with you. I am sorry!