Display More Data Points
in
Core Library Questions
•
1 year ago
I have am gathering analog data with an Arduino Uno. Using Processing, I can only display one serial event at a time. I need it to store data continuously. How do I do that.
Here is my code:
Here is my code:
- import processing.serial.*;
Serial myPort;
String bits;
PFont font;
void setup() {
size(800,200);
myPort = new Serial(this, "COM1", 9600);
myPort.bufferUntil('\n');
font = loadFont("TimesNewRomanPSMT-12.vlw");
textFont(font);
}
void draw() {
//The serialEvent controls the display
}
void serialEvent (Serial myPort){
bits = myPort.readStringUntil();
if(bits != null){
bits=trim(bits);
}
writeText("Bits: " + bits);
}
void writeText(String textToWrite){
background(255);
fill(0);
text(textToWrite, width/20, 10);
}
1