A little while ago I was playing with some sensors I had, and though how nice it’d be if I could graph their outputs on my computer. So I wrote a simple program in the Processing language to do just that. Although the code I wrote was able to get strings of data from my Arduino, the code I am posting here is somewhat stripped out to be as understandable as possible to beginners. Instead of displaying data from sensors, this program graphs your mouse’s x- and y-coordinates. It is still capable of plotting data from sensors, but you’ll have to write the code to fetch and handle the data. As is explained in the comments in the code, there are three variables (integers) to store incoming data points (newDataPoint1, newDataPoint2 and newDataPoint3), each of which corresponds to one of the graphs. Your data-handling code will have to feed each of these variables one new integer each iteration of the draw loop in order for this program to function properly. Currently, newDataPoint1 and newDataPoint2 are being set to the mouse’s x- and y-coordinate respectively and newDataPoint3 is just set to “0” (not being used). Thus for users with a little experience with Processing it should be quite easy to modify this code to your needs.
Here’s what it looks like (the blue line at the top is the third graph which is currently not being used):