Hi there helper,
I tried your code, maybe i did something wrong. I changed the variables into mine. but all i get is 3 white bars with a small pink one. I just can’t get it done.
besides that, I would like 3 lines in 1 graph. each another colour.
this is my code; and what i get out of that.
String[] list = new String[3];
int k = 5;
int y0=110, dy0=120;
import processing.serial.*; // bibliotheek van seriële communicatie
Serial myPort; // seriëel object wordt gemaakt
String val; // de data die ontvangen wordt van de seriële poort
int pressure;
int temperature;
int density;
void setup(){
size(800,360);
background(200,200,0);
String portName = Serial.list()[0]; // de poort waar het signaal binnen komt
myPort = new Serial(this, portName, 9600);
}
void draw(){ // if new data from arduino Ain raw as string:
if ( myPort.available() > 0)
{ // If data is available,
val = myPort.readStringUntil('\n'); // read it and store it in val
if (val != null)
{
//println(val); //print it out in the console
String [] list = split(val, ';');
pressure = int(list[0]);
density = int(list[1]);
temperature = int(list[2]);
float val1 = map(int(list[0]),0,1023,0,100);
float val2 = map(int(list[1]),0,1023,0,100);
float val3 = map(int(list[2]),0,1023,0,100);
stroke(200,0,200);
line(k,y0+0*dy0,k,y0+0*dy0-val1);
line(k,y0+1*dy0,k,y0+1*dy0-val2);
line(k,y0+2*dy0,k,y0+2*dy0-val3);
stroke(255);
line(k+1,y0+0*dy0,k+1,y0+0*dy0-100);
line(k+1,y0+1*dy0,k+1,y0+1*dy0-100);
line(k+1,y0+2*dy0,k+1,y0+2*dy0-100);
k++;
if ( k> width-5 ) k=5;
}
}
}
this is the graph he shows me, it moves slowly to the right, but nothing happends.
please help me.
