hello everyone, i apologize for my bad english yet, hope you can understand what my problem is:
i'm using arduino to take voltage values, then i send them to the serial port in this form:
Serial.println(float,float,float,int,int);
data i send are stored in some array in arduino memory thus this instruction is a part of loop, so i send to the serial port multiple lines of the same type as this:
...
float,float,float,int,int
float,float,float,int,int
float,float,float,int,int
float,float,float,int,int
... and so on
i'd like processing to take these data from the serial port and then save them in some arrays in order analyze and plot.
so i wrote this code for processing:
void serialEvent(Serial port) {
measure = commPort.readStringUntil('\n');
int i = 0;
if (measure != null) {
String[] valori_misura = new String[5];
valori_misura = split(measure, ",");
ps_voltage = parseFloat(valori_misura[0].trim());
PS_VOLTAGE[i]=ps_voltage;
c_voltage = parseFloat(valori_misura[1].trim());
C_VOLTAGE[i] = c_voltage;
current = parseFloat(valori_misura[2].trim());
CURRENT[i] = current;
ps_time = parseInt(valori_misura[3].trim());
PS_TIME[i] = ps_time;
c_time = parseInt(valori_misura[4].trim());
C_TIME[i]=c_time;
/*println(ps_voltage);
println(c_voltage);
println(current);
println(ps_time);
println(c_time+"\n");*/
i++;
}}
hoping you've understood the code and what i want to do, i've a problem becouse i'm not able to print values of one of the arrays(eg.PS_VOLTAGE) ;
it's wrong how i save data? where do i have to put the for loop to print data?