Hi, so I’m working on a semi-emergency project where people can draw on a canvas across the internet and it is converted to Gcode for a drawing robot I built. The problem is, it seems to really get bogged down when I do this live. Right now, it is a simple script using the processing net library:
The client has the following –
I have a mousePressed event, a mouseDragged, and a mouseReleased. The pressed sends a line of gcode telling the drawing tool to move into position and put the pen down on the paper, the drag event is basically a constant live update of the current mouse position (so as they drag around, it draws) and the release event sends a line of gcode saying “lift the pen up”.
This all works fine, but every now and then, because it seems to be sending THOUSANDS of strings to my server it really really slows it down, particularly all the mouseDragged events. Is there a way to say “only write every X seconds from a mousedragged event”? Since a mouseDragged is just a mouse movement with a “is it pressed” attached, can I pull only certain amounts of data, or will it ALWAYS be every tiny pixel of movement?