pde with serial support for a usb serial i/o board works perfectly. export to exe and exe hangs with gray screen and must use task manager to stop it.
If i remove Serial support and export it runs , everything works but commented out i/o serial functions Only usbio is present , Device Manager sees it as COM6 There is only one COM port detected so rs232=0 stays 0 The pde runs and reports SERIAL PORT DETECTED message , verifying it is indeed seen by processing as COM6 when run. Writing to the port makes a lamp come on and off. It all works, but when i export it , the exe hangs upwith a gray screen and no error msg Only way to stop it is with task manager!
I'm really frustrated , how can it work in the pde when run and not the exported exe! I have POwer management off on all usb hubs that have the tab. What else can cause this?
import processing.serial.*;
Serial myPort0;
Serial myPort1;
usbio=0;
rs232=0;
if(Serial.list().length==0)
{
fill(255,0,0);
textSize(20);
rect(imgstartcol,490+rtxt,640,50+rtxt);
fill(0);
text("NO USB SERIALS PORT DETECTED ",440,517+rtxt);
}
if(Serial.list().length>0)
{
fill(0,255,0); // clear USB PORT MSG area
textSize(20);
rect(imgstartcol,490+rtxt,640,100);
fill(0);
for(x=0;x<Serial.list().length;x++)
{
if( (Serial.list()[x].substring(0,3)).equals("COM"))
{
if(x==0)
{usbio=1; // I/O seen
text("USB SERIAL PORTS DETECTED "+Serial.list()[x],440,517+rtxt+(x*20)); // display USB port msg until 1st test started
}
if(x==1)
{rs232=1; // chk later to output value to rs232 mill host computer
text(", "+"COM X",790,517+rtxt+(0*20)); // display USB port msg until 1st test started
}
}
}
}
if(usbio==1)
{// set in/out pins on i/o chip
myPort0 = new Serial(this, Serial.list()[0], 9600);
myPort0.write("CU,1,0"+"\n"); // turn off OK response every command
myPort0.write("PD,B,0,0"+"\n"); // B0 output vacuum
myPort0.write("PD,B,1,0"+"\n"); // B1 output not used
myPort0.write("PD,B,4,0"+"\n"); // B4 output lamp
myPort0.write("PD,B,3,1"+"\n"); // B3 input not used
myPort0.stop();
}