ofSerialTest problem... serial event?

Okay so I’m having some strange behavior coming out of the ofSerialTest example…

on first click:
http://farm4.static.flickr.com/3260/2329092371-4655ebb1f1.jpg?v=0
LED on Arduino blinks, but nothing read back into OFW…

second click:
http://farm3.static.flickr.com/2389/2329092425-736299b7be.jpg?v=0
LED blinks, bunch of garbage

third click:
http://farm3.static.flickr.com/2072/2329916374-f0e2952e06.jpg?v=0
bunch of garbage again…

I programmed my arduino using the example code… the only thing I modified is what pin my LED is on. The call/response works fine from the serial monitor in Arduino:

I tried this on a couple of different Macs, both Tiger.

Any thoughts?

Related:
I don’t suppose there is something already in OFW like a serial event (ie. mousePressed, keyPressed)? If not, I’m wondering how I would go about coding it myself…

Thanks kindly,

-C

what platform? what compiler?

can you try 0.05 - if you are on xcode or devcpp:
http://www.openframeworks.cc/files/005-rc/
and see if it works?
we have made some changes, via joerg’s suggestions of reading writing in chars, not strings.

thanks!
zach

some other questions – does a simple processing sketch return good data?

for me, callback raises the following questions:

a) how many bytes do you try to read from the serial to know that you get a callback in the first place? ie, serial isn’t push driven, it’s pull driven, that you pull data.

b) i think you’d get some mad latency issues, since you would be able to flush the buffer (ie, read as much as possible) w/ a callback driven system

the answer is probably something like the firmata protocol, which erik’s been working on (See cppglue)…

take care!
zach

Thanks for the advice, zach.

I was following the string/byte serial thread, but will give it a more careful look.

Processing consistently gets data returned on the fifth try…
http://farm4.static.flickr.com/3051/2329396733-c7dc890c02.jpg?v=0

even if i put delays of 500ms in between frames… the magic number is always five sends calls before a response. :shock:

I am on Xcode 2.4.1 IDE… I think GCC 4.0 is the compiler?

trying 005… will report back

-C

005 try: works (almost) perfectly

http://farm3.static.flickr.com/2298/2330250952-2a12560b1d.jpg?v=0

i still get just an LED blink on the first click, but at least the subsequent clicks seem okay. Will be doing more testing tonight and tomorrow, seeing if im getting old bytes.

I am using the Arduino Decemilia board, and someone is telling me that they had the same problem… maybe something funny with that.

… :shock: C

the problem may have related to the conversion of ofSerial to use strings, which was a mistake we made in 0.04 when we started putting strings everywhere. Joerg posted fixes in the forum about this. I didn’t see a problem on my board, but it could be something wrong with logic (anyway, communicating binary data in a strings a terrible idea).

happy that helps!!

take care,
zach