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 › What does this error mean
Page Index Toggle Pages: 1
What does this error mean? (Read 352 times)
What does this error mean?
Feb 26th, 2009, 2:02am
 
Hi, I am using the serial simple write example that came with processing to communicate with my arduino via the sparkfun bluesmirf bluetooth modem. I am running this on windows Vista x64.

Here is the code:

import processing.serial.*;

Serial myPort;  // Create object from Serial class
int val;        // Data received from the serial port

void setup()
{
 size(200, 200);
 // I know that the first port in the serial list on my mac
 // is always my  FTDI adaptor, so I open Serial.list()[0].
 // On Windows machines, this generally opens COM1.
 // Open whatever port is the one you're using.
  println(Serial.list());
 String portName = Serial.list()[4];
 myPort = new Serial(this, portName, 9600);
}

void draw() {
 background(255);
 if (mouseOverRect() == true) {  // If mouse is over square,
   fill(204);                    // change color and
   myPort.write('H');              // send an H to indicate mouse is over square
 }
 else {                        // If mouse is not over square,
   fill(0);                      // change color and
   myPort.write('L');              // send an L otherwise
 }
 rect(50, 50, 100, 100);         // Draw a square
}

boolean mouseOverRect() { // Test if mouse is over square
 return ((mouseX >= 50) && (mouseX <= 150) && (mouseY >= 50) && (mouseY <= 150));
}

When I run the code I get this error:

Error inside Serial.write()

java.io.IOException: No error in nativeDrain
at gnu.io.RXTXPort.nativeDrain(Native Method)
at gnu.io.RXTXPort$SerialOutputStream.flush(RXTXPort.java:1201)
at processing.serial.Serial.write(Serial.java:508)
at SimpleWrite.draw(SimpleWrite.java:52)
at processing.core.PApplet.handleDraw(PApplet.java:1423)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Unknown Source)
Exception in thread "Animation Thread" java.lang.RuntimeException: Error inside Serial.write()
at processing.serial.Serial.errorMessage(Serial.java:588)
at processing.serial.Serial.write(Serial.java:511)
at SimpleWrite.draw(SimpleWrite.java:52)
at processing.core.PApplet.handleDraw(PApplet.java:1423)
at processing.core.PApplet.run(PApplet.java:1328)
at java.lang.Thread.run(Unknown Source)


Does anyone know what this error means? I have checked to verify that the baud rates and com ports are correct, nothing seems to be wrong accept that this error keeps popping up and the program stops running. The strange thing is that my arduino does get a signal (led lights up), but the program still stops running and spits out the error. I have gotten this program to work with my previous computer running on windows XP. The only thing that has really changed is that I am using a different usb dongle, rather than the built in one on my previous laptop.

Thanks.
Page Index Toggle Pages: 1