We are about to switch to a new forum software. Until then we have removed the registration on this forum.
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. If you believe this can be done, I just found how not to go running in the woods during the next week-end.
Pierre
Answers
Yes its totally possible and most simple.
You can use Serial library to communicate with your Arduino. A simple myport.read() function would read values from Arduino.
You can set a pre-defined values that when received by Arduino, it will initiate some action.
For example you can use myport.write(#FF) to switch on led. You have to program Arduino to switch led on when it receives that hex value.
similarly you can use a myport.write(#1005) to rotate motor. #10 to identify it as motor command. #05 say might be the angle by which you want to rotate the motor.
(All hex values are just as example. You can define your own protocol to do the same.)
Thank you, Deamon4, I appreciate. And will therefore start studying the tutos. Pierre