<div dir="ltr"><div><div>Hi everyone<br><br></div><div>An update/more questions<br><br></div>Yep I got Arduino talking to ChucK now with the<b> <a href="http://ints.ck">ints.ck</a> </b>script in the Serial folder under examples (don’t know why it wasn’t there so I just downloaded source/help files again!).  Although I cant seem get <b>seiralRecvArduino_3.ck</b> to receive any data from my Arduino. Is there a way of modifying<b>  <a href="http://ints.ck">ints.ck</a> </b>to receive /parse the incoming values from my x4 potentiometer?<br>
<br></div><div>Thanks for any explanations/advice-much appreciated!<br></div><div><br><br></div><div>Alan<br><br></div><div>My Arduino code is below<br><br><br>// the setup routine runs once when you press reset:<br>void setup() {<br>
  // initialize serial communication at 9600 bits per second:<br>  Serial.begin(9600);<br>}<br><br>// the loop routine runs over and over again forever:<br>void loop() {<br>  // read the input on analog pin 0 to 4:<br>  int sensorValue0 = analogRead(A0);<br>
  int sensorValue1 = analogRead(A1);<br>   int sensorValue2 = analogRead(A2);<br>  int sensorValue3 = analogRead(A3);<br>   int sensorValue4 = analogRead(A4);<br>  // print out the value you read:<br>  Serial.println(sensorValue0);<br>
   Serial.println(sensorValue1);<br>    Serial.println(sensorValue2);<br>     Serial.println(sensorValue3);<br>     Serial.println(sensorValue4);<br>  delay(1);        // delay in between reads for stability<br>}<br></div>
<div><br><br><br><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Jan 3, 2014 at 4:19 AM, Steve Morris <span dir="ltr"><<a href="mailto:steve@judgement.com" target="_blank">steve@judgement.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">In case anyone is interested Firmata is two things. 1) It is a piece of software that runs on Arduino that allows sensors to be read via a serial port protocol. 2) The serial protocol is also called Firmata or the Firmata protocol. The Firmata protocol has a more or less midi format (sysex) and can be parsed by standard midi interpreters/parsers. I haven't looked at the ChucK midi support but it may be that 95% of the code needed for a Firmata client is already in that package. In fact it might be easiest to implement a Firmata client as a special mode of the standard ChucK midi package.<div>


<br></div><div>The nice thing about it is that the Firmata firmware gets serious maintenance so you basically just load it to the Arduino and it works. It can read most standard sensors that plug into the Arduino. It was originally written to allow processing apps to read Arduino sensors and display the results allowing processing to basically be a gui front end for an Arduino. Firmata client libraries/plugins are now available in a variety of languages including PureData as Alan mentioned earlier. It has become the defacto way to access Arduino sensors from a remote host via a serial port. ChucK absolutely needs someone to write a Firmata client library and it should be bundled with the core ChucK package. It would make using Arduino sensors in ChucK a simple plug and play, basically bug free operation. A lot of work has already been done to connect various sensors/controllers to music systems using Arduino/Firmata. Making all of that work available to ChucK users would be a big win.<div>


<br></div><div>The protocol is documented here:</div><div><br></div><div><a href="http://firmata.org/wiki/V2.3ProtocolDetails" target="_blank">http://firmata.org/wiki/V2.3ProtocolDetails</a><br></div><div><br></div><div>
Firmata doesn't solve every possible Arduinio interface need but it covers 95% of what most people want to do.</div>

<div><br></div><div>-steve aka zencuke</div><div><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jan 2, 2014 at 10:00 PM, Joel Matthys <span dir="ltr"><<a href="mailto:jwmatthys@yahoo.com" target="_blank">jwmatthys@yahoo.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>+1 to the Firmata interface idea.<br>
      <br>
      Joel<br>
      <br>
      On 01/02/2014 06:23 PM, Steve Morris wrote:<br>
    </div>
    <blockquote type="cite">someone should do a ChucK interface to Firmata. It is
      a good starting point. <span></span>Maybe I'll give it a whack. <br>
      <br>
      On Thursday, January 2, 2014, Alan Brooker wrote:<br>
      <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
        <div dir="ltr">
          <div dir="ltr" style="font-family:arial,sans-serif;font-size:13.333333969116211px">Hi
            Spencer/Steve,
            <div><br>
            </div>
            <div>Thanks for your reply and thoughts, much
              appreciated...hmm I'm not getting Arduino & ChucK to
              Communicate at the moment but I think I need to work more
              on my Arduino code more to communicate with ChucK- up to
              now I have been using Firmata with Pure Data, which only
              requires the the Firmata sketch to upload. As you say
              there is a lot of stuff here to look at so will report
              back :)</div>
            <div><br>
            </div>
            <div>Thanks again!</div>
          </div>
          <div style="font-family:arial,sans-serif;font-size:13.333333969116211px">
            <div><img src="https://mail.google.com/mail/images/cleardot.gif"></div>
          </div>
        </div>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote">On Thu, Jan 2, 2014 at 2:54 AM,
            Spencer Salazar <span dir="ltr"><<a>spencer@ccrma.stanford.edu</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Hi Al,
                <div><br>
                </div>
                <div>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. </div>
                <div><br>
                </div>
                <div>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 <a href="http://lines.ck" target="_blank">lines.ck</a> 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. </div>
                <div><br>
                </div>
                <div>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. </div>
                <div><br>
                </div>
                <div>Thats a lot of stuff, so let us know if you have
                  any more questions.  </div>
                <div><br>
                </div>
                <div>spencer</div>
                <div><br>
                </div>
              </div>
              <div class="gmail_extra"><br>
                <br>
                <div class="gmail_quote">
                  <div>
                    <div>On Wed, Jan 1, 2014 at 9:59 AM, Alan Brooker <span dir="ltr"><<a>alan.brooker2010@gmail.com</a>></span>
                      wrote:<br>
                    </div>
                  </div>
                  <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                    <div>
                      <div>
                        <div dir="ltr">
                          <div>
                            <div>Hi there<br>
                              <br>
                            </div>
                            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 <cite><b>x5
                                potentiometer</b>s </cite>that send
                            values to an arduino board and then into
                            ChucK hopefully. Was hoping I could do this
                            without OSC- <br>
                            <br>
                            thanks for helping this noob!<br>
                            <br>
                          </div>
                          <br>
                          <br>
                          Al<br>
                        </div>
                        <br>
                      </div>
                    </div>
                    _______________________________________________<br>
                    chuck-users mailing list<br>
                    <a>chuck-users@lists.cs.princeton.edu</a><br>
                    <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
                    <br>
                  </blockquote>
                </div>
                <br>
              </div>
              <br>
              _______________________________________________<br>
              chuck-users mailing list<br>
              <a>chuck-users@lists.cs.princeton.edu</a><br>
              <a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
              <br>
            </blockquote>
          </div>
          <br>
        </div>
      </blockquote>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
chuck-users mailing list
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu" target="_blank">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br></div>
</div></div><br>_______________________________________________<br>
chuck-users mailing list<br>
<a href="mailto:chuck-users@lists.cs.princeton.edu">chuck-users@lists.cs.princeton.edu</a><br>
<a href="https://lists.cs.princeton.edu/mailman/listinfo/chuck-users" target="_blank">https://lists.cs.princeton.edu/mailman/listinfo/chuck-users</a><br>
<br></blockquote></div><br></div>