Serial data display
in
Core Library Questions
•
7 months ago
Hello Everyone;
I'm trying to display some simple serial data coming from an Arduino to a processing applet in way such that the continuous data keeps on scrolling down in a fashion similar to the
Arduino IDE's serial monitor. In a way you can tell that I'm trying to make a serial monitor in processing with the data continuously scrolling & not
fixed at a place & changing .
A sketch which takes care of the later condition of -"
fixed placed continuously changing serial value monitor
" is given below:
import processing.serial.*;
PFont fontB;
Serial port;
int freq = 0;
void setup()
{
size(680, 420);
port = new Serial(this, "COM8", 115200);
port.bufferUntil('\n');
fontB = loadFont("ArialMT-48.vlw");
textFont(fontB, 48);
}
void draw()
{
background(0);
fill(255);
text(freq, 350, 350);
}
void serialEvent (Serial port)
{
String inString = port.readStringUntil('\n');//reading from serial data until new line
if (inString != null)
{
//conversion of the string into integer
inString = trim(inString);
freq = int(inString);
}
}
Can anybody help me here ps? It's for a project that I'm making & would really appreciate if anybody can guide me here a bit.
1