Can an PWM-piloted device be piloted graphically from Processing?

Hello, I am absolutely new to Processing and decently knowledgeable with Arduino. I am not looking for you guys to bring a ready-made solution but to enlight me on whether or not I should invest a bit of time to learn Processing. I am pretty sure it's an excellent piece of software, but there are so many things to do and so littletime I'd like to know beforehand if I should dive into the tutos.
My questions :

Context : a device is controled by an Arduino, using PWM. The device can be a DC motor or a LED. If it's a DC motor, it will accelerate during a brief period of time (Time 1), work at full-speed during time 2, and deccelerate during time 3 (and stay still during time 4 that is not shown on the diagram. Same logic would apply if it would be a LED.

Question 1: is it possible to have Processing draw a line graph similar to the one depicted above, based on the current measured (through analog.read() or directly by exploiting the values used for analog.write() ? Sometimes, the total duration of the cycle might not exceed 100 ms. Can Processing cope with that?

Question 2 (more complex): would it be possible to "program" the Arduino controlling the Motor or LED directly from the Processing IDE ? And of course, displaying the line graph at the same time. Option a : using lines of code (written isnstructions) ? Option b : drawing directly the profile (which means, I guess, drawing first a 2D plan, with time in X and intensity in Y.

Thank you for your input. I have actually also posted this on the Processing forum, but since I have no exepriecne with the Processing community, I have no clue if it is as active and reactive as the Arduino one.
Pierre

Question 1: is it possible to have Processing draw a line graph similar to the one depicted above

Similar to the one below, yes. There being no picture above it, that's a little harder. But, Processing is good at black screens...

based on the current measured (through analog.read() or directly by exploiting the values used for analog.write() ?

Those will be two completely different values.

Sometimes, the total duration of the cycle might not exceed 100 ms. Can Processing cope with that?

Yes. Though in 50 ms, you won't get many values sent from the Arduino to Processing.

Question 2 (more complex): would it be possible to "program" the Arduino controlling the Motor or LED directly from the Processing IDE ?

That depends on what you mean by program in quotes. You can not change the program on the Arduino, but you can change the data that the Arduino has to deal with.

Question 1: is it possible to have Processing draw a line graph similar to the one depicted above, based on the current measured (through analog.read() or directly by exploiting the values used for analog.write() ? Sometimes, the total duration of the cycle might not exceed 100 ms. Can Processing cope with that?

I wonder is there some circular logic here?

Either Processing is drawing a graph of what the motor is doing based on data received from the Arduino

OR it is controlling the motor from a pre-existing "graph" (actually from the data used to draw the graph). Of course the pre-existing graph might have been created just a few seconds (or milliseconds) earlier.

...R

Thank you both. Your answers will help me, whether it is to move on in my project or get better at writing and illustrating posts.

Attn Robin2 : You are right, there would be circular logic in trying to interface Processing and Arduino to top both tasks. Since I actually had little knowledge of what Processing could do, I sort of scaled my questions : level 1 (Processing can “illustrate” an Arduino-written sketch) and level 2 (Arduino reacting to a graph drawn - hence programmed - in Processing. I never intended to do both actions at the same tie, but did not express myself clearly enough. Thank you anyway.

Attn PaulS : I can feel or sense some sort of tongue-in-cheek humor in your answer to question 1 but I need confirmation (do not conclude I am totally deprived of any sense of humor. It just means that English is not my mother-tongue). Your referecne to a black screen might you could not see the pix. It appeared when I previewed my message before posting it (and still appera when I look again at it). Anyhow, the remaining of your answer was helpfull.

Pierre

I can feel or sense some sort of tongue-in-cheek humor in your answer to question

A tiny bit.

but I need confirmation (do not conclude I am totally deprived of any sense of humor. It just means that English is not my mother-tongue).

You got it.

There was no picture above the question, so I assumed you meant that you wanted Processing to display nothing (or a big black box).

There was a picture below the question, which Processing can be programmed to display.

Laughing out loud!
You seems to be as flexible with the use of this beautiful (and convenient) English language as I am with my kids when they talk to me in French.
Hence, can't complain. Looks like "above" and "below" have specific meanings in English.
I like this forum where I not only refine my understanding of Arduino but also my language skills.
Let's see if I master the Smiley option.
:smiley:
Yeah !