I figured Jordan would pipe up at the mention of mkfifo. (pun intended ;) Yeah, I'm totally not thinking through the process here. It's best to decide that you're doing serial at 9600 baud, say, and read from /dev/ttyUSB using python, say, and then write to a named pipe and read from that pipe with chuck. (Still using an ASCII protocol). Since Chuck's FileIO blocks, you tell Chuck to read as fast as possible in a single shred and route data using Events (Chuckian). BUT, my point is that this could be set up very simply to always work the same way without having to fiddle with it each time you want to read your Arduino data. If you got super-fancy you could create a udev rule to always have this run when it sees the Arduino.
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).
Yeah, but you have "mad scientist" in your resumé. ;)
-mike
http://michaelclemow.com
http://semiotech.org
On Mon, Mar 5, 2012 at 3:13 PM, Kassen
On Mon, Mar 05, 2012 at 02:54:10PM -0500, Jordan Orelli wrote:
wait a second... can ChucK just read from /dev/ttyUSB directly? I don't know how the /dev files operate, but maybe what we're saying is a really roundabout way of just mounting the arduino as a TTY like in the article I linked and having ChucK read from the device file. I don't have an arduino to try it out, but... it's worth trying if anyone wants to give it a whirl ;)
I think so. I never tried it with a arduino, but a bit ago I was trying to get some annoying multi-media keys to work and just ran "cat" on the "/dev/input/blah-blah-blah" of the keyboard to confirm I was getting data.
You can, they are just files. For some you may need root and some of the stuff in /dev may be best left alone, on top of that nothing says the output you get will make intuitive sense... but yes you can. Basically everything in Unix is abstracted to the OS as being a file and those you can read from or write to, just like any other process can.
Have fun, Kas.
Disclaimer; poking around is good fun and educational. It's safe to assume that all UNIX experts poked around... but it's also safe to assume that the expertise was gained in learning what not to touch by burning one's finger. (same holds true for Windows, BTW) _______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users