How do I show a text message for a predefined time on screen?
in
Programming Questions
•
2 years ago
I am currently reading in a text message sent from an Arduino. I read in the message into the PC serial port and displaying the message on the PC screen. No problem with that part.
My problem is that can't seem to display the message on the PC for a few seconds and then clear it.
Heres my code:
import processing.serial.*;
Serial myPort;
PFont f; // STEP 2 Declare PFont variable
String inBuffer;
void setup() {
size(300,300);
f = loadFont("ArialMT-32.vlw"); // STEP 3 Load Font
myPort = new Serial(this, Serial.list()[1], 9600);
background(255);
}
void draw(){
while (myPort.available() > 0) {
delay(40);
inBuffer = myPort.readString();
if (inBuffer != null) {
textFont(f,32); // STEP 4 Specify font to be used
fill(0); // STEP 5 Specify font color
text (inBuffer, 70,100); //Write out Buffer to Screen
delay(10);
background(255);
}
}
}
My problem is that can't seem to display the message on the PC for a few seconds and then clear it.
Heres my code:
import processing.serial.*;
Serial myPort;
PFont f; // STEP 2 Declare PFont variable
String inBuffer;
void setup() {
size(300,300);
f = loadFont("ArialMT-32.vlw"); // STEP 3 Load Font
myPort = new Serial(this, Serial.list()[1], 9600);
background(255);
}
void draw(){
while (myPort.available() > 0) {
delay(40);
inBuffer = myPort.readString();
if (inBuffer != null) {
textFont(f,32); // STEP 4 Specify font to be used
fill(0); // STEP 5 Specify font color
text (inBuffer, 70,100); //Write out Buffer to Screen
delay(10);
background(255);
}
}
}
1
