Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Re : how to save serial data received from arduino

$
0
0
i kinda solved it with this code:
  1. void serialEvent(Serial port) {
  2.   

  3.   measure = commPort.readStringUntil('\n');


  4.   if (measure != null) {

  5.     String[] valori_misura = new String[5];
  6.     valori_misura = split(measure, ",");

  7.     ps_voltage = parseFloat(valori_misura[0].trim());
  8.     c_voltage = parseFloat(valori_misura[1].trim());
  9.     current = parseFloat(valori_misura[2].trim());
  10.     ps_time = parseInt(valori_misura[3].trim());
  11.     c_time = parseInt(valori_misura[4].trim());

  12.     PS_VOLTAGE = append(PS_VOLTAGE, ps_voltage);
  13.     C_VOLTAGE = append(C_VOLTAGE, c_voltage);
  14.     CURRENT = append(CURRENT, current);
  15.     PS_TIME = append(PS_TIME, ps_time);
  16.     C_TIME = append(C_TIME, c_time);
  17. }}

Viewing all articles
Browse latest Browse all 1768

Trending Articles