when I run the program for 20 minute it will get slower and then stop and say it out of memory
I think problem is at code below
if (port.available()>0){
String val=port.readString();
String list=split(val,‘,’);
pressglobe= int(list[0]);
lowlim1globe=int(list[1]);
uplim1globe=int(list[2]);press2globe=int(list[3]);
lowlim2globe=int(list[4]);
uplim2globe=int(list[5]);press3globe=int(list[6]);
lowlim3globe=int(list[7]);
uplim3globe=int(list[8]);
the Arduino just sent the data from serial port to this program as 10,20,10 something like this
any body have an idea please help
btw this is all of my code
// Need G4P library
import g4p_controls.;
import processing.serial.;
import meter.*;
Serial port;
Meter m1,m2,m3;
public String txt=“”;
public String txt2=“”;
public String txt3=“”;
public int pressglobe=0;
public int lowlim1globe=0;
public int uplim1globe=0;public int press2globe=0;
public int lowlim2globe=0;
public int uplim2globe=0;public int press3globe=0;
public int lowlim3globe=0;
public int uplim3globe=0;public int MODEglobal=0;
public int MODE2global=0;
public int MODE3global=0;int screen =0;
GButton screenbutton;
GTextArea txa;
public void setup(){
frameRate(60);port = new Serial(this,“/dev/cu.wchusbserial1420”,9600);
size(900, 950, JAVA2D);
background(254,254,254);
customGUI();m1=new Meter(this, 230,50);
m1.setTitle(“Pressure(kPa)1”);
String scaleLabels1={“-50”,“-40”,“-30”,“-20”,“-10”,“0”,“10”,“20”,“30”,“40”,“50”,“60”,“70”,“80”,“90”,“100”};
m1.setScaleLabels(scaleLabels1);
m1.setDisplayDigitalMeterValue(false);
m1.setMinInputSignal(-50);
m1.setMaxInputSignal(100);m2=new Meter(this, 230,350);
m2.setTitle(“Pressure(kPa)2”);
String scaleLabels2={“-50”,“-40”,“-30”,“-20”,“-10”,“0”,“10”,“20”,“30”,“40”,“50”,“60”,“70”,“80”,“90”,“100”};
m2.setScaleLabels(scaleLabels2);
m2.setDisplayDigitalMeterValue(false);
m2.setMinInputSignal(-50);
m2.setMaxInputSignal(100);m3=new Meter(this, 230,650);
m3.setTitle(“Pressure(kPa)3”);
String scaleLabels3={“-50”,“-40”,“-30”,“-20”,“-10”,“0”,“10”,“20”,“30”,“40”,“50”,“60”,“70”,“80”,“90”,“100”};
m3.setScaleLabels(scaleLabels3);
m3.setDisplayDigitalMeterValue(false);
m3.setMinInputSignal(-50);
m3.setMaxInputSignal(100);}
public void draw(){
if(screen==0){
screenbutton = new GButton(this, 10, 10, 80, 30);
screenbutton.setText(“Setting”);
screenbutton.addEventHandler(this, “screenbutton_click1”);
}
if(screen==1){
screenbutton = new GButton(this, 10, 10, 80, 30);
screenbutton.setText(“BACK”);
screenbutton.addEventHandler(this, “screenbutton_click1”);
}if (port.available()>0){
String val=port.readString();
String list=split(val,‘,’);
pressglobe= int(list[0]);
lowlim1globe=int(list[1]);
uplim1globe=int(list[2]);press2globe=int(list[3]);
lowlim2globe=int(list[4]);
uplim2globe=int(list[5]);press3globe=int(list[6]);
lowlim3globe=int(list[7]);
uplim3globe=int(list[8]);}
if(screen==0){
if(pressglobe<lowlim1globe){
m1.setArcColor(color(254,0,0));
m1.setScaleFontColor(color(254,0,0));
}
if(pressglobe>uplim1globe){
m1.setArcColor(color(254,0,0));
m1.setScaleFontColor(color(254,0,0));
}
if(pressglobe>=lowlim1globe && pressglobe<=uplim1globe){
m1.setArcColor(color(0,254,0));
m1.setScaleFontColor(color(0,254,0));
}if(press2globe<lowlim2globe){
m2.setArcColor(color(254,0,0));
m2.setScaleFontColor(color(254,0,0));
}
if(press2globe>uplim2globe){
m2.setArcColor(color(254,0,0));
m2.setScaleFontColor(color(254,0,0));
}
if(press2globe>=lowlim2globe && press2globe<=uplim2globe){
m2.setArcColor(color(0,254,0));
m2.setScaleFontColor(color(0,254,0));
}if(press3globe<lowlim3globe){
m3.setArcColor(color(254,0,0));
m3.setScaleFontColor(color(254,0,0));
}
if(press3globe>uplim3globe){
m3.setArcColor(color(254,0,0));
m3.setScaleFontColor(color(254,0,0));
}
if(press3globe>=lowlim3globe && press3globe<=uplim3globe){
m3.setArcColor(color(0,254,0));
m3.setScaleFontColor(color(0,254,0));
}
clear();
background(254,254,254);
text(pressglobe,750,200);
text(press2globe,750,495);
text(press3globe,750,795);
m1.updateMeter(pressglobe);
m2.updateMeter(press2globe);
m3.updateMeter(press3globe);}
if(screen==1){
background(254,254,254);
textSize(20);
fill(0);
text(“Lower limit (1):”,35,200);
text(int(lowlim1globe),220,200);
text(“Upper limit (1):”,35,250);
text(int(uplim1globe),220,250);
text(“Name:”,420,120);text(“Lower limit (2):”,35,420);
text(int(lowlim2globe),220,420);
text(“Upper limit (2):”,35,470);
text(int(uplim2globe),220,470);
text(“Name:”,420,335);text(“Lower limit (3):”,35,640);
text(int(lowlim3globe),220,640);
text(“Upper limit (3):”,35,690);
text(int(uplim3globe),220,690);
text(“Name:”,420,553);if(MODEglobal==0){
text(“<–”,255,200);
}
if(MODEglobal==1){
text(“<–”,255,250);
}
if(MODE2global==0){
text(“<–”,255,420);
}
if(MODE2global==1){
text(“<–”,255,470);
}
if(MODE3global==0){
text(“<–”,255,640);
}
if(MODE3global==1){
text(“<–”,255,690);
}
if(MODEglobal>1){
MODEglobal=MODEglobal-2;
}
if(MODE2global>1){
MODE2global=MODE2global-2;
}
if(MODE3global>1){
MODE3global=MODE3global-2;
}}
}// Use this method to add additional statements
// to customise the GUI controls
public void customGUI(){
if(screen==1){ //screen1
background(254,254,254);
createGUI();
}if(screen==2){ //screen2
background(254,254,254);
button7.setVisible(false);
button8.setVisible(false);
button9.setVisible(false);
button10.setVisible(false);
button11.setVisible(false);
button12.setVisible(false);
button13.setVisible(false);
button14.setVisible(false);
button15.setVisible(false);
textfield1.setVisible(false);
textfield2.setVisible(false);
textfield3.setVisible(false);}
}
void screenbutton_click1(GButton source, GEvent event){
screen++;
customGUI();
println(screen);
if(screen>1){
screen=screen-2;
}
}
for button builder generate by G4P
public void button7_click1(GButton source, GEvent event) { //CODE:button7:829860:
port.write(‘a’);
} //CODE:button7:829860:public void button8_click1(GButton source, GEvent event) { //CODE:button8:462719:
port.write(‘b’);
} //CODE:button8:462719:public void button9_click1(GButton source, GEvent event) { //CODE:button9:376359:
port.write(‘c’);
MODEglobal++;
} //CODE:button9:376359:public void button10_click1(GButton source, GEvent event) { //CODE:button10:303933:
port.write(‘d’);
} //CODE:button10:303933:public void button11_click1(GButton source, GEvent event) { //CODE:button11:289312:
port.write(‘e’);
} //CODE:button11:289312:public void button12_click1(GButton source, GEvent event) { //CODE:button12:805311:
port.write(‘f’);
MODE2global++;
} //CODE:button12:805311:public void button13_click1(GButton source, GEvent event) { //CODE:button13:237472:
port.write(‘g’);
} //CODE:button13:237472:public void button14_click1(GButton source, GEvent event) { //CODE:button14:421737:
port.write(‘h’);
} //CODE:button14:421737:public void button15_click1(GButton source, GEvent event) { //CODE:button15:292777:
port.write(‘i’);
MODE3global++;
} //CODE:button15:292777:public void textfield1_change1(GTextField source, GEvent event) { //CODE:textfield1:812558:
String txt = textfield1.getText();
m1.setTitle(txt);
} //CODE:textfield1:812558:public void textfield2_change1(GTextField source, GEvent event) { //CODE:textfield2:374267:
String txt2 = textfield2.getText();
m2.setTitle(txt2);
} //CODE:textfield2:374267:public void textfield3_change1(GTextField source, GEvent event) { //CODE:textfield3:640877:
String txt3 = textfield3.getText();
m3.setTitle(txt3);
} //CODE:textfield3:640877:// Create all the GUI controls.
// autogenerated do not edit
public void createGUI(){
G4P.messagesEnabled(false);
G4P.setGlobalColorScheme(GCScheme.BLUE_SCHEME);
G4P.setCursor(ARROW);
surface.setTitle(“Sketch Window”);
button7 = new GButton(this, 50, 83, 107, 57);
button7.setText(“UP”);
button7.addEventHandler(this, “button7_click1”);
button8 = new GButton(this, 175, 83, 107, 57);
button8.setText(“DOWN”);
button8.addEventHandler(this, “button8_click1”);
button9 = new GButton(this, 300, 83, 107, 57);
button9.setText(“SELECT”);
button9.addEventHandler(this, “button9_click1”);
button10 = new GButton(this, 50, 300, 107, 57);
button10.setText(“UP”);
button10.addEventHandler(this, “button10_click1”);
button11 = new GButton(this, 175, 300, 107, 57);
button11.setText(“DOWN”);
button11.addEventHandler(this, “button11_click1”);
button12 = new GButton(this, 300, 300, 107, 57);
button12.setText(“SELECT”);
button12.addEventHandler(this, “button12_click1”);
button13 = new GButton(this, 50, 517, 107, 57);
button13.setText(“UP”);
button13.addEventHandler(this, “button13_click1”);
button14 = new GButton(this, 175, 517, 107, 57);
button14.setText(“DOWN”);
button14.addEventHandler(this, “button14_click1”);
button15 = new GButton(this, 300, 517, 107, 57);
button15.setText(“SELECT”);
button15.addEventHandler(this, “button15_click1”);
textfield1 = new GTextField(this, 490, 97, 160, 30, G4P.SCROLLBARS_NONE);
textfield1.setOpaque(true);
textfield1.addEventHandler(this, “textfield1_change1”);
textfield2 = new GTextField(this, 490, 314, 160, 30, G4P.SCROLLBARS_NONE);
textfield2.setOpaque(true);
textfield2.addEventHandler(this, “textfield2_change1”);
textfield3 = new GTextField(this, 490, 531, 160, 30, G4P.SCROLLBARS_NONE);
textfield3.setOpaque(true);
textfield3.addEventHandler(this, “textfield3_change1”);
}// Variable declarations
// autogenerated do not edit
GButton button7;
GButton button8;
GButton button9;
GButton button10;
GButton button11;
GButton button12;
GButton button13;
GButton button14;
GButton button15;
GTextField textfield1;
GTextField textfield2;
GTextField textfield3;