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 & HelpElectronics,  Serial Library › Serial Write Error Message
Page Index Toggle Pages: 1
Serial Write Error Message (Read 1709 times)
Serial Write Error Message
Nov 10th, 2007, 2:09am
 
I am using a FTDI USB to Serial converter chip to send data at 2400 baud
Code:

import processing.serial.*;

Serial port;

void setup()
{
port = new Serial(this, 2400);
}

void draw()
{
port.write(170);
port.write(170);
delay(1000);
}


And I receive this error
Code:

Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7

java.lang.NullPointerException
at processing.serial.Serial.write(Serial.java:502)
at Temporary_1405_2451.draw(Temporary_1405_2451.java:12)

java.lang.RuntimeException: Error inside Serial.write()
at processing.serial.Serial.errorMessage(Serial.java:583)
at processing.serial.Serial.write(Serial.java:506)
at Temporary_1405_2451.draw(Temporary_1405_2451.java:12)
at processing.core.PApplet.handleDisplay(PApplet.java:1359)
at processing.core.PGraphics.requestDisplay(PGraphics.java:680)
at processing.core.PApplet.run(PApplet.java:1454)
at java.lang.Thread.run(Unknown Source)


What is wrong? I wired up everything right, my devices are powered, my converter chip is functioning. The code is legit, and even if I run an example code with a higher baud rate, I get the same error.

I need to solve this problem by Saturday night, Sunday is the competition.

I am running Processing 0125 under Ubuntu 7.10
Re: Serial Write Error Message
Reply #1 - Nov 18th, 2007, 2:51am
 
hi,

Just wondering whether you resolved this error?
Cos I am also encountering this error at the moment.

Pat
Re: Serial Write Error Message
Reply #2 - Nov 18th, 2007, 5:06am
 
it's a bad example code, look in the reference for better examples.
Page Index Toggle Pages: 1