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.
Page Index Toggle Pages: 1
PIC & Processing (Read 597 times)
PIC & Processing
Oct 19th, 2008, 8:57pm
 
Hi,

I'm having some trouble getting the Serial library to work with data that I'm reading from a PIC. I'd like to use processing to turn the data stream into a nice GUI...

Here's what my PIC output looks like if read into Hyperterminal (or other telnet program):

+ -107
-170
-188
 99
 99

+ -107
-170
-188
 86
 86

+ -107
-170
-188
 94
 94

+ -108
-170
-188
 76
 76

+ -108
-170
-188
 93
 93

There are 5 signed integers (seperated by tabs) which update with about 200ms in between each line. The '+' denotes the start of the line. I'd like to extract the values and assign them to 5 variables in processing that will control size / colour etc. I don't really want to change the format of the data (i.e. removing the tabs) as I still need to display it in my terminal program.

I've tried using the readByte() and ReadByteUntil() examples (with various numbers of bytes) but I always get this sort of messy output:

+ -108
-

170
-188
 97
 97



+ -108
-170
-187


 99
 99


ReadBytesUntil() also complains that the buffer isn't big enough for my string and crashes processing.

Could anyone give me some tips on what's going wrong with the examples and what the best way to go about this problem is. i.e How do I get processing to recognise the tabs between my values and the new lines?
Re: PIC & Processing
Reply #1 - Oct 19th, 2008, 10:01pm
 
Are you using the latest release? readBytesUntil() had a bug in the older releases that would cause that.
Page Index Toggle Pages: 1