# Date from Arduino in Processing

**URL:** <https://discourse.processing.org/t/date-from-arduino-in-processing/34909>\
**Category:** Electronics (Arduino, etc.)\
**Created:** [January 31, 2022, 9:17am UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909 "2022-01-31T09:17:12Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![musa](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@musa](https://discourse.processing.org/u/musa)\
**Post date:** [January 31, 2022, 9:17am UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/1 "2022-01-31T09:17:12Z")

</div>

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);  
}  
}`

---

<div class="post-metadata">

**Author:** ![fastfourier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fastfourier/32/2764_2.png) [@fastfourier](https://discourse.processing.org/u/fastfourier)\
**Post date:** [January 31, 2022, 12:40pm UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/2 "2022-01-31T12:40:25Z")

</div>

Hello! This looks like it will indeed plot two sets of numbers. But what is a “normal signal”?

---

<div class="post-metadata">

**Author:** ![musa](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@musa](https://discourse.processing.org/u/musa)\
**Post date:** [January 31, 2022, 4:57pm UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/3 "2022-01-31T16:57:39Z")

</div>

Hi, thank you for the answer. I mean wanna to see the signal exactly as in arduino Ide and not as a point. I am sending you the results in Arduino ide and in Processing

 ![Aarduino](https://canada1.discourse-cdn.com/flex036/uploads/processingfoundation1/original/2X/8/8d008e0314be673c16c2b34b1d89268556e7805c.jpeg)  
Uploading: processing.JPG…

---

<div class="post-metadata">

**Author:** ![fastfourier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fastfourier/32/2764_2.png) [@fastfourier](https://discourse.processing.org/u/fastfourier)\
**Post date:** [January 31, 2022, 5:07pm UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/4 "2022-01-31T17:07:41Z")

</div>

Oh you mean a proper graph with scales and everything. Use the grafica library. It looks like what they’re using in the Arduino IDE.

---

<div class="post-metadata">

**Author:** ![musa](https://avatars.discourse-cdn.com/v4/letter/m/898d66/32.png) [@musa](https://discourse.processing.org/u/musa)\
**Post date:** [January 31, 2022, 7:16pm UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/5 "2022-01-31T19:16:06Z")

</div>

yes, thats exactly what I meant. I’ve already overridden the library. Unfortunately I still can’t get any signal. Do you have any examples?

---

<div class="post-metadata">

**Author:** ![fastfourier](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/fastfourier/32/2764_2.png) [@fastfourier](https://discourse.processing.org/u/fastfourier)\
**Post date:** [January 31, 2022, 7:38pm UTC](https://discourse.processing.org/t/date-from-arduino-in-processing/34909/6 "2022-01-31T19:38:02Z")

</div>

You’ve done _what_ to the library?

Not sure why it isn’t showing up. There are a lot of examples with grafica. I seem to remember needing to call `plot.setPoints(yourGPointsArray);` again to update the graph.
