Hi, Im quite new with processing and Ive been trying it for a while.
Im trying to make a graph to display the information of an analog sensor.
Im receiving by Serial a 3 digit STRING number of the analogue value: 0-255 successfuly and printing it in a textbox. Now, trying to make a graph, I used the curveVertex(x, y); method. My problem comes when I try to put that STRING number into the curveVertex(x, y) where I get an error that I cant put a STRING in those varibles.
Is where I tried to convert the STRING into an INTEGER with Integer.parseInt but it just saves in the string the 3 digit number several times until it overflows and gives an error: NumberFormatException:for input string: 2682702692
while what I wanted was the 268, then the 270, and then the 269.
my questions are: is there any way to put in the CurveVerte(x,y) a String? or how can I convert that string into an integer or anything I can use for the CurveVertex?
Here is my code:
import processing.serial.*;
Serial myPort; // The serial port
void setup()
{
size(400,400);
background(255);
println(Serial.list());
myPort = new Serial(this, Serial.list()[3], 9600);
}
void draw()
{
// Expand array size to the number of bytes you expect