We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › serial works... for a bit
Page Index Toggle Pages: 1
serial works... for a bit (Read 332 times)
serial works... for a bit
Jul 21st, 2006, 5:08am
 
I could use a little help figuring out a problem I'm having with serial on a Mac. I'm sending information to a Milford DMX controller (Part# 1-463) via serial (with a Keyspan USB to serial adapter) to control Lamina super-bright LED's.

Serial has been giving me hell. I have read all of the FAQ's for serial and read every bug report I could find involving serial. Serial works just fine for a while. Sometimes it will work for over 2 hours sometimes 10 min. But, it always ends up freezing. I get no warnings in the Processing window initially. All signals stop being sent. When I restart processing I get the "gnu.io.PortInUseException: Unknown Application" error. I have run the "macosx_setup.command" on all computers, so it's not that. The only way for me to get it to run again is to unplug the keyspan and plug it back in. I have tried this on Various G5's, a titanium G4, a 12" G4 and a 15" MacBook. I have also run  my code through every version of Processing between 0109 to the most current release. Everyone who has problems with serial seem to run into problems getting it running at first but no one seems to have problems after it is working.

I am at a total loss.
I can get it to crap out on the simplest code.

//-------------------------------------------------

import processing.serial.*;

Serial port1;

color port1_color;
int angle = 0;
int ct = 0;
int my_delay = 50;

void setup() {
 size(200, 200);
 background(255);
 println(Serial.list());
 colorMode(HSB, 360, 255, 255);
 port1_color = color(0, 255, 255);
 port1 = new Serial(this, Serial.list()[2], 9600, 'N', 8, 1.0);
}

void draw() {
 colorMode(HSB, 360, 255, 255);
 if (angle <= 360) {
   angle++;
   port1_color = color(angle, 255, 255);
 }
 else {
   angle = 0;
   port1_color = color(angle, 255, 255);
 }

 colorMode(RGB, 255, 255, 255);
 port1.write(1);
 port1.write((int)red(port1_color));
 port1.write(2);
 port1.write((int)green(port1_color));
 port1.write(3);
 port1.write((int)blue(port1_color));
 background((int)red(port1_color), (int)green(port1_color), (int)blue(port1_color));
 delay(my_delay);
}

//-------------------------------------------------

What keeps grabbing the port? How do I stop this from happening? Any suggestions would be so greatly appreciated.
Page Index Toggle Pages: 1