[chuck-users] Serial/Arduino & ChucK example

Spencer Salazar spencer at ccrma.stanford.edu
Wed Jan 1 21:54:18 EST 2014


Hi Al,

If you check out the chuck examples folder that came in the chuck download
or in the "Open Example" menu item, there should be a "serial" subcategory
with some basic examples of communicating with serial devices (e.g.
Arduino) in there.

What I would recommend is sending your 5 analog values as a space separated
series of ASCII numbers, ending with a newline, and repeating this at
whatever your desired refresh rate is. In ChucK, you can use
onLine()/getLine() (as in the lines.ck example) to get each line of data,
which includes all 5 current sensor values. There is also a (minimally
documented) RegEx class you can use to pull out the values individually and
then convert them to integers.

Ive also attached another ChucK example I have that does something very
similar to this, except it reads only 3 sensor values and uses commas to
separate values.

Thats a lot of stuff, so let us know if you have any more questions.

spencer



On Wed, Jan 1, 2014 at 9:59 AM, Alan Brooker <alan.brooker2010 at gmail.com>wrote:

> Hi there
>
> I am using ChucK 1.3.2.0 (Chimera) with miniAudicle 1.3.0a on Ubuntu
> 12.04- I think the latest version can communicate with Arduino directly?
> Cant seem to find any examples so any advice  or example code would be much
> appreciated. I am trying to build a simple step sequencer with *x5
> potentiometer*s that send values to an arduino board and then into ChucK
> hopefully. Was hoping I could do this without OSC-
>
> thanks for helping this noob!
>
>
>
> Al
>
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140101/32216cf0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: seiralRecvArduino_3.ck
Type: application/octet-stream
Size: 1011 bytes
Desc: not available
URL: <http://lists.cs.princeton.edu/pipermail/chuck-users/attachments/20140101/32216cf0/attachment.obj>


More information about the chuck-users mailing list