We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Basically what im trying to do is to communicate an arduino with processing to graph the temperature.
Im sending this from arduino via serial :
Serial.print(superior); Serial.print(","); Serial.print(inferior); Serial.print(","); Serial.println(valor_sensor_enviar);
delay(2000);
so I basically need to store "superior" and "inferior" and represent the third variable data which is continuosly changing between 50 and 0.
So I tried this :
import processing.serial.*;
Serial port;
int i,k; int temp; String buffer; int[] valor_anterior=new int[150]; int[] valor_auxiliar=new int[150]; int[] datos=new int[10]; int[] pdatos=new int[10]; int x=65; int nX=400,nY=400; int j; int valor_supeior; int valor_inferior; int saltodelinea=10;
void setup()
{
port = new Serial(this, Serial.list()[1], 9600); background(255);
size(700 ,400); }
void draw() { if(port.available()>=1){
buffer = port.readStringUntil(saltodelinea);
port.clear();
if (buffer != null) {
buffer = trim(buffer);
datos = int(split(buffer, ','));
}}}
It works for a short period of time and then crashes giving me the error in the title of this post. Ive been investigating about the error and it seems to be a problem of space in the array I declared. Actually im "SUPOSED" so save 3 INTs in a vector which has space for 10 of them, so why does it crash? Can anyone help me out?
Answers
https://forum.Processing.org/two/discussion/14988/drawing-of-graphs-from-i2c-imu
Ive tried using splitTokens like in that example and declared all arrays as new ints. Still the problem isnt solved.
I modified the code to print in processing console the information im getting from arduino and it seems to be fine, but it still crashes after some loops.
Please post formatted code. Highlight code and hit CTRL+O:
https://forum.Processing.org/two/discussion/8045/how-to-format-code-and-text