We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello. I am having problems with exporting a program with serial library. When i run the program in Processing it works fine, but when i open .exe file, a window opens up bot the program that i wrote is not there... I am using import processing.serial.*; to get the temperature from the arduino and display it on the screen, Here is my code:
import processing.serial.*;
Serial port;
String temp = "";
String vlaz = "";
String data = "";
int index = 0;
PFont font;
void setup()
{
size(400,400);
port = new Serial(this, "COM5", 9600);
port.bufferUntil('.');
font = loadFont("AgencyFB-Bold-200.vlw");
textFont(font,200);
}
void draw()
{
background(0,0,0);
fill(46,209,2);
text(temp,50,175);
fill(0,102,153);
text(vlaz,50,370);
}
void serialEvent (Serial port)
{
data = port.readStringUntil('.');
data = data.substring(0, data.length() - 1);
index = data.indexOf(",");
temp = data.substring(0,index);
vlaz = data.substring(index + 1, data.length());
}
Here is the window in Processing working: http://prntscr.com/4pa6tk But when i run the . exe file it just opens the window with the backgroud color that i picked when i was making export: http://prntscr.com/4pa71h And it also is not showing "stop" button at the bottom. I tested one other program with no serial and it worked at the export... so i think something is wrong with serial library, or i can be wrong.
Answers
What version of Processing are you using?
I am using the latest 2.2.1
This is a known bug: https://github.com/processing/processing/issues/2559
This bug is fixed in the pre-release of Processing 3.0, which is available from the download page.
Do i need to download 2.1.2 or ?
You need at least Processing 3.0 alpha 1.
Thank you, it works.