Input Data from Command Line

I am trying to create a system to test motors and propellers and include a nice GUI using Processing. I am using an Arduino to measure some data but am also using certain other measurement tools that need to be plugged directly into the computer. Is it possible for Processing to read serial data from the Arduino as well as the computer’s command lines? I’m still relatively new to Processing so I’m not sure how to stream in data from anything other than the Arduino.

1 Like

I did not need to list this but did anyway!

It all started here:

I have had success with these individually and in combination to create some very cool projects:

  1. Serial communications
  • Processing to\from Ardunio
  • Processing to\from Processing
  • Processing to applications that use serial communications
  • Processing to any hardware that has serial communications
  1. Network Client to Server

  2. Data from Network and PC
    XML, JSON, tables, text files, etc.

  3. Sound

  4. Interactivity:

  • keyboard, mouse and check out tools and libraries!
  1. Print

  2. GUI interface to run a command-line tool
    I used some JAVA directly for this in the Processing applications.
    It was to control my LCD screen colors; I created an interface to a free command-line tool that did this.

  3. Video

  4. And… check out the tools and libraries in the Processing software!

  5. And… there are other modes like Android mode!
    Ketai libraries:

I mostly just tinker with it as a hobby and posted some videos here:



This is a few years old but still works with W10

This is a version 0.1 of mouse buttons sending command-line arguments to an app (app not included here):

String str1 = "3000";
int num = 1000;
boolean inc = false;
int num2 = 100;
boolean inc2 = false;

void settings()
  size(200, 150, P2D);
void draw()
  fill(255, 255, 0);
  textAlign(CENTER, CENTER);
  text(num, 100, 50);
  text(num2, 100, 100); 
void mousePressed()

  if (mouseButton == LEFT)
    if (inc)
    if (num > 6500)
      inc = false;
      num = 6500;
    if (num < 1000)
      inc = true;
      num = 1000;

  if (mouseButton == RIGHT)
    if (inc2)
    if (num2 > 100)
      inc2 = false;
      num2 = 100;
    if (num2 < 20)
      inc2 = true;
      num2 = 20;

  launch("C:\\app\\app.exe", Integer.toString(num), Integer.toString(num2));
  println(num, " ", num, " ", num2);
1 Like

Thank you so much for all of your help!
Where is this program streaming data from the command line though?

All I was doing at the time was launching and passing arguments to the app.exe.

This will require more exploration on your part.


I am able to launch cmd.exe and pass arguments with below:

Examples tested:

exec(new String[] {"cmd", "/K", "start", "cmd.exe", "/K","help"});
exec(new String[] {"cmd", "/K", "start", "cmd.exe", "/K","ping"});


1 Like

Not entirely clear what you want to achieve.

A command line: do you mean the user can type commands into your sketch?

Or is another program running (in DOS?) that sends out data? How does it send them?

1 Like

I have something like 30 Amps of current running through my system so I have a powerful ammeter to track the current. The Ammeter connects to the National Instruments USB-6210 which has its own C-based library to send the readings into the computer. I am trying to make a Processing GUI for these readings as well as other readings coming from an Arduino. I know how to load serial data from an Arduino but I haven’t yet figured out how to get the data from the C++ program into Processing.

It isn’t clear what you mean by this. It seems like you have some other program that is receiving the data. Via Serial? USB or network cable? Maybe USB? If you have a library for getting values from the USB device using another language, you could rebroadcast that information on a local protocol, e.g osc etc – there are lots of io and networking libraries for Processing.

It is possible in theory but there would be some research to be done unless you can find some resource out there that is doing this for you already. I am sure there are some people that have come up with libraries to access data from other languages like C or C++. In other words, possibly not an out-of-the-box solution. You do not need to focus your search limited to Processing. You could search any java module and it is very likely you can use this in Processing as it is Java after all.

You mentioned you want to get the data from the command prompt. From what I understand, you already have a program that read your NI module, correct? You can inquire this DAQ module using your command line command. As you have reported, you could use exec() to run this command and possible read the returned value returned after executing the command (This needs to be tested…). Is this enough for your case?

If the data is arriving via serial, you can try using RealTerm to see if you can capture the serial stream. If you are able to do this, then you should try the serial library in Processing and read the data stream directly. Keep in mind that if you are using an arduino, you might need to test working with two serial connections. I believe this is possible…