The folks at CCRMA are maintaining a nice set of pd objects to send/receive OSC messages over serial connections.
Unfortunately the latest available binaries (pd_OSCserial_externs20070810.tar.gz - linked off the AVR wiki page) don't deal very well with sending messages from Pd to an attached microcontroller. I've written some patches - until they are folded into the source, I'll make them available here.
Source: serialIO.c
Mac OS X (intel) binary: serialIO.pd_darwin
Test patch to exchange messages with Arduino_Osc firmware: arduino_osc_pd_0001.zip
(open arduino_osc.pd)
Test patch to exchange messages with Wiring_Osc firmware: wiring_osc_pd_0002.zip
(open wiring_osc.pd)
Change log:
12/2/08: 0002 - made pins 0 & 1 available, fixed slider ranges to use 10bit
Earlier versions: wiring_osc_pd_0001.zip
Notes on adding OSCserial objects into a fresh Pd-extended installation:
Notes on compiling serialIO from source on OS X:
#LDFLAGS = -bundle -bundle_loader /usr/lib/pd/bin/pd -flat_namespace
LDFLAGS = -bundle -bundle_loader /Applications/Pd-extended.app/Contents/Resources/bin/pd -flat_namespace
Notes on changes to serialIO.c:
messages from Pd to a microcontroller are *not* wrapped, but sent raw.
This confuses serial OSC parsers on the other end of the connection.
Patch: modified serialIO_FullPacket() to wrap messages.
serialIO_float() lead to dropped bytes in outgoing OSC messages - at
38400 on my Mac, only ~1 in 5 messages made it out unharmed.
Patch: commented out tcflush(); called tcdrain() at end of
serialIO_FullPacket(). Note: not sure if this change interferes with
single-byte or single-float output; needs to be tested (maybe call
tcdrain() inside _byte() and _float()?).
with a char variable local to calling function's scope (got
interpreted as 32-bit value instead of 8-bit); fixed by changing
signature of function to take unsigned char (huh?).
outgoing bytes to printing both unsigned decimal and hexadecimal
values.