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 › Not reading from the buffer
Page Index Toggle Pages: 1
Not reading from the buffer (Read 712 times)
Not reading from the buffer
Dec 15th, 2009, 7:36pm
 
I have a sparkfun.com/commerce/product_info.php?products_id=8180 .  I've written code before that handled serial fine, but for some reason I cant get processing to take any data off of the buffer.

I've tried using the usual serialEvent, but it never gets called, so I thought I'd check in draw() for .available() and then just tried using .read() without even checking.  However, no matter what I try, processing simply will not read from the buffer of this device.

I'm able to send data to it, I can even get it to connect to another BT device and send data across the link, to an arduino that responds, even.  I can configure the device, but get no response from it, as processing won't read from the buffer.

When I open hyperterminal with the same port settings, it reads everything that was in the buffer, and works like you'd expect.  I've even tried varying the baud rate (9600,57600,115200).

Any help would be greatly appreciated.
Processing 1.0.9, Windows 7x64, FTDI 2.06.00 (tried 2.02.04 as well)

--Edit--:
I've also tried Vista x64, with similar results

Code:
import processing.serial.*;
static String COMPORT = "COM4";
Serial myPort;

void setup() {
 size(200,200);
 myPort = new Serial(this, COMPORT, 9600);
}

void draw() {
 background(50,100,200);
}

void keyPressed() {
 if (key == 65535) return;
 myPort.write(key);
}

void serialEvent(Serial myPort)
{
 int data = myPort.read();
 println(data + " : 0x" + hex(data,2) + " : '" + char(data)+"'");
}
Page Index Toggle Pages: 1