We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Good morning. nice to meet you.
I am writing this because of the speed of processing draw statements.
I envisioned a program between Arduino and a computer. And we created the program through processing. As you can see, the SETUP statement runs once when the program starts and the DRAW statement repeats every time.
However, the speed of the DRAW statement is relatively slow, so getting the data from Arduino is a problem.
1) What is the speed of repetition of DRAW?
2) Also, is there a way to speed up?
Please answer fast.
Answers
60 fps by default, but you can change it using framerate().
however, that is only a suggested maximum. if your frames take 1/5th of a second to execute you'll only get 5fps no matter how many you ask for.
i have an inkling that draw() is not your problem, just because you are asking that question.
Dear koogs.
Since I have experimented, the maximum frame rate per second seems to be about 300. Is not there a way to do more than that?
Serial data is handle by a separate thread. I will think it will process your data if it arrives faster than Processing's current upper limit frame rate. However, it is processing's upper limit which will not allow you to run at the same speed as your thread. Try increasing the frame rate using the frameRate() function to see if you can match to your input data rate.
You can check this next example. Click to stop updating the canvas to see the difference in the counters. Adjust the framerate in setup to see the difference. it demonstrates that a separate rate can run faster than draw().
Related to your arduino, I am going to take a wild guess here. When serialEvent gets called, you have to call readBuffer() as many times as possible until the buffer is emptied out. Is this is true, then you do not need to change the frameRate() but you just need to make sure you handle all the data available in the serial buffer.
Kf
Dear kfrajer,
Thread - this is the answer.
Thank you. I remembered a good idea. This is the right answer.
Dear koogs, Dear kfrajer
I was able to create a measurement program. 10 [kHz] can be measured through the 'thread'.
Thank you.