pde runs fine, exe does not start hangs , Serial support is stopping exe

edited November 2017 in Arduino

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;   


  text("NO USB SERIALS PORT DETECTED ",440,517+rtxt); 

  fill(0,255,0);  // clear USB PORT MSG area 

   if( (Serial.list()[x].substring(0,3)).equals("COM")) 
     {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
     {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

  {// 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


  • Absolutely bizarre! I had imported opencv lib to use brightness adjustment on image it didn't give results i wanted so removed all reference to opencv, checked and double checked this! If i put opencv import lib back, put back opencv calls but never use result anymore, just having opencv in program makes it run as exported exe i tryed commenting out opencv import and all calls, exported exe , no worky uncomment and export works again. commenting or removing serial support with exe that hangs also lets it run, without serial support so worthless other than debug test to try to isolate issue to something that makes sense. Again, all pde versions of code work when run from processing

    Is processing really this buggy?

  • edited November 2017

    I had the same problem some time ago. Seems like it will always hang if there is nothing connected to any serial port.

    Your code is running inside an infinite loop or it runs only once?

    If it just run once I think there is not much problem as you will know that it will only work if something is connected first.

  • I have seen that as well. No all serial ports are working when i run pde. no busy ports, device manager recognizes , they all work when run as pde from processing. whatever the time is it takes to export , and run the exe , they dont and program hangs at gray screen. The problem isn't the serial ports , it the serial library. I thought of using a command line utility to execute serial commands to my simple i/o interface. But i can't even use Serial.list() to get what com's are recognized ! The serial port is fundamental. I now see a lot of posts with folks struggling with serial com The serial lib needs to be debugged.

    I found it works as long as i import opencv !? Somebody should dig into souce and figure out why that is. I programmed in C for years, never had issues like this.

Sign In or Register to comment.