[chuck-users] serial communication and chuck

Jordan Orelli jordanorelli at gmail.com
Mon Mar 5 13:23:17 EST 2012

The arduino can't mount the file system of the ChucK host, so you'd still need an intermediate process to read the data from the arduino and write it into the pipe, but that may be as simple as `mkfifo mypipe; chuck mywhatever.ck; cat /dev/ttyUSB > mypipe`, where mywhatever.ck has an open file handle on mypipe, reading from it continuously.  There's a concern about fifos being synchronous by default and that a writer with a higher throughput than the ChucK process on the reading side would become blocked, which I can see not really jiving with ChucK's timing guaranteed.  fifo(7) discusses using fifos in a non-blocking fashion but I'm a little vague on " Normally, opening the FIFO blocks until the other end is opened also.  A process can open a FIFO in nonblocking mode.", since I don't know if a process has to do something special in order to get that behavior and it's scant on details, but I've had the blocking natures of fifo's bite in the ass before.  http://linux.die.net/man/7/fifo

> the problem is setting properties like the baud rate and so on.

There's an article discussing such /dev/ttyUSB tomfoolery here: http://arduino.cc/playground/Interfacing/LinuxTTY.  It mentions a usage of the stty command that I believe addresses Kas's concerns, but I haven't tried it yet so I'm not sure.

seems dangerous but it just might work.

On Mar 5, 2012, at 12:57 PM, Kassen wrote:

> On Mon, Mar 05, 2012 at 12:48:56PM -0500, mike clemow wrote:
>> and then read from tochuck using file i/o objects?  I know it's hackish, but
> I don't think that's so hackish, that's how UNIX is supposed to work
> and why the "everything is a file" thing is nice. :-) If you like you
> can also write numbers to the file that represent your soundcard, at
> least on Linux you can (you may want to disable some of those pesky
> modern drivers first).
> As I understood the discussion that is exactly what is planned and
> partially what people are already doing, but the problem is setting
> properties like the baud rate and so on.
> I like this, I'm quite in favour of simple things that work; it's
> rarely the simple things that ruin my day and when they do they tend
> to do so in ways that are at least predictable.
> Yours,
> Kas.
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

More information about the chuck-users mailing list