Hi guys,
I want to sent my data ( PPG-ECG wavs) from Arduino uno in Processing and then plot it
I tried to write a code for it. that partially worked and now I want to extend it. So instead of plotting the data as points, I want normal signals to plot
can someone help me with this!
`import processing.serial.*;
// import the Processing serial library
import processing.serial.*;
import java.io.BufferedWriter;
import java.io.FileWriter;
Serial myPort; // The serial port
// Test values
int v1 =0;
int v2 = 255;
int x;
int NumOfScopes,NumOfInput=2;
void setup() {
size(640,480);
// Open serial port
//printArray(Serial.list());
myPort = new Serial(this, Serial.list()[0], 115200);
// Read bytes into a buffer until you get a linefeed (ASCII 10):
myPort.bufferUntil(’\n’);
//draw with smooth edges:
//smooth();
background(255);
}
void draw() {
// Draw circles
fill(204, 102, 0);
ellipse(x, v1, 5, 5);
fill(#00ff00);
ellipse(x, v2, 5, 5);
// Update x position
x++;
// Refresh screen
if (x > 600) {
background(255);
x = 0;
}
}
// serialEvent method is run automatically by the Processing applet
// whenever the buffer reaches the byte value set in the bufferUntil()
// method in the setup():
void serialEvent(Serial myPort) {
// read the serial buffer:
String myString = myPort.readStringUntil(’\n’);
println(“raw: \t” + myString);
// if you got any bytes other than the linefeed:
myString = trim(myString);
// split the string at the commas
// and convert the sections into integers:
int values[] = int(split(myString, ‘,’));
if (values.length >= 2) {
v1 = values[0];
v2 = values[1];
printArray(v1);
println(v2);
}
}`