sending and receiving data with Processing and Arduino

Hello. I need to send 2 pot values from the Arduino to Processing and then output from Processing (depending on those values) to the Arduino's 4 digital pins and 2 analog PWM pins. Sounds so simple but I am really having a hard time with my level of experience.

I have tried using the Firmata program on the Arduino but have found the analog reads to be very unreliable even when just using the Firmata examples without modification on Arduino and Processing.

Every tutorial I have found involving call and response or punctuation for duplex sending and receiving data with the Arduino does not send full data in both directions, usually just a handshake in one direction and data in the other. Any guidance would be so appreciated.

Thank you for reading this and your patience.

I need to send 2 pot values from the Arduino to Processing and then output from Processing (depending on those values) to the Arduino's 4 digital pins and 2 analog PWM pins. Sounds so simple but I am really having a hard time with my level of experience.

Can you elaborate on what calculations/display/etc. is being done within the Processing environment. Processing is a Java environment, so unless the host PC has plenty of resources objects can stay swapped-out of main memory.

You do know that Processing cannot "input" to the Arduino PWM pins ... they are output only. In fact, without a DAC somewhere in your project, The PC application cannot directly output any analog signals.

Have you thought of just using another Arduino (nano/mini/micro) for the second device? Kind of goes back to my 1st question of what is happening in Processing?

Ray

Hi Ray and thanks!!!

1.In the processing environment I am taking a windows joystick, comparing pots sent from the Arduino and then controlling on the Arduino four relays and two proportional valves.

2.Sorry I confused things. I tried to say I am controlling two pins from Processing on the Arduino to generate a PWM signal to a valve.

3.I need a windows environment for various joysticks and game controllers that are running game applications.

For the code on the Arduino side you may find the examples in Serial Input Basics useful.

...R

what a beautiful work...thank you. love to have something on the processing side

house231:
what a beautiful work...thank you. love to have something on the processing side

Thank you. And, sorry, I don't use Processing - what about Python ? :slight_smile:

...R

love to have something on the processing side

You can do EXACTLY the same thing in Processing. Well, almost. You would use Strings, instead of strings, but that is not a problem on a PC with plenty of memory.