How do I save the values of my sensor in a file?
I have a parallax ping sensor, and would like to save the values in a file. To work the movement of objects on the screen, such as circles, lines and squares.
I'm using the right reading? I confess I'm confused. I have to use byte or string?
Does anyone have a better idea?
void draw() {
// Expand array size to the number of bytes you expect
byte[] inBuffer = new byte[7];
while (myPort.available() > 0) {
inBuffer = myPort.readBytes();
myPort.readBytes(inBuffer);
if (inBuffer != null) {
String myString = new String(inBuffer);
//println(myString);
createOutput(myString="/home/samuel/sketchbook/distan.txt");
}
Well, I do not have much practice with processing. I planned to use the values obtained by Arduino + parallax ping sensor to draw lines on the monitor according to the distance from my hand to the sensor. But I have no idea how to use these values, so I store them in text file. It could even generate circles according to the distance. Example: if I position the hand in the middle of the monitor, right there for the right to draw lines.