How do I use Processing to read and write data to an Arduino

Looking for a front end to manage Arduino data from a PC.
I Know the arduino side (Serial IO and parsing), looking for a PC side option.
The need is to read data from the arduino, make changes, and write updated data back to arduino.
Actual task is managing EEE memory configuration data.

Looking for examples of user interaction, such as creating entry form with text display and input, pick lists, etc.

1 Like

Hello,

Here are some links to get you started:
https://learn.sparkfun.com/tutorials/connecting-arduino-to-processing/all
https://processing.org/reference/libraries/serial/index.html (some of the examples need an update)
https://www.oreilly.com/library/view/arduino-cookbook-2nd/9781449321185/ch04.html
https://github.com/processing/processing/tree/master/java/libraries/serial

There are some examples that come with Processing and Arduino.

There is lots of discussion on this topic out there and in this forum also.

I have written all of my own serial communication routines building on what I have gleaned from examples and my own experience.

:)

1 Like

https://processing.org/tutorials/electronics/

1 Like

glv

Thank you for the links.
The serial part I understand. The examples are pretty clear.
What I am looking for is how to create a user facing form/dialog in Processing to let the user type in numbers or select from a list. If I have the data from the user, I know how to get the data to/from the Arduino.
So, the front end options/examples are what I need.
E.G.,

  • How to present text?
  • how to capture text from the user?
  • how does the user select from a list?
    Thomas Stephens DeSoto, TX
1 Like

Hello,

I gleaned through the available resources and there may be something for you in there.

Resources < Click here to expand !

I encourage you to review the resources available here:

:)

Libraries:

The libraries and tools in the Processing IDE:

:)

1 Like

Thank you.
I will give interfascia a try.

@McLae5 – did interfascia end up working out for you?

no time to work with it yet.
Still working on the program flow. Not the same as Arduino sketches.

Thomas Stephens DeSoto, TX

Interfascia looks like oit will do what I want, as soon as I learn more about Java. (Old C/C++ programmer)

Looking at the radio button example, I see how radio buttons are displayed, but how do I determine which has been selected? As in in finding which button was last pushed?
I tried to set a text label with the selected button id/reference/index and could not figure out the syntax for converting an index into a parameter the label would take.
If strings are static, how to I change the text in a string?
This is likely simple JAVA, but new to me.

Documentation is not what I am use to.

String s = "foo";
s = "bar";

The String itself is a static object, but the variable can be reassigned to a new String.

Or, methods on the String don’t change the String, they return a new String – which you assign to the reference.

s = s.replace('r', 'z');  // bar -> baz

So the old string is destroyed automatically? (Java vs C memory management)

Any examples available for changing a text or label object based on radio button selection?
As in, select this button, text says “First”, select second bubtton text says “Second”, back to first button, text says “First”.
Looking for how to capture user action for further processing.

Thomas Stephens DeSoto, TX

Yes, it is eventually garbage-collected when no references point to it. If something still points to it, no, e.g.

String s  = "bar";
String s2 = s;
s = s.replace("r", "z");

Now s = “baz”, while s2 = “bar” (the original String object, which still has a reference pointing to it, and won’t be garbage-collected).

1 Like

So does this work?
String s = “Foo”’.
s = “Bar”;
print(s);
Should show “Bar”, right?

1 Like

Yes – just paste it into PDE and try it!

String s = "Foo";
s = "Bar";
print(s);

Bar