<div dir="ltr"><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Thank you for spending so much time looking at this!  Being new to this side of arduino I am learning a great deal. </div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">I'm testing your ...._korr2.ino sketch.  Viewing the serial monitor shows me the expected input from the faders in the pd patch.  However, I get no response from the led strip.  I commented out your original Serial.println (fad[0]); here:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div class="gmail_default"> char pattern[] = "/fad/0"; // "/fad/N" is better OSC style than "/fadN"</div><div class="gmail_default">    </div><div class="gmail_default">    for (int i = 0; i < 9; ++i){</div><div class="gmail_default">      // change the number in the address to the current index.</div><div class="gmail_default">      // if you want it to work with numbers that have more than a single digit you have to adapt the code</div><div class="gmail_default">      pattern[5] = i + '0';</div><div class="gmail_default">      if (msg.fullMatch(pattern, 0)){</div><div class="gmail_default">        // then check if first item is an integer</div><div class="gmail_default">        if (msg.isInt(0)){</div><div class="gmail_default">          // use the integer argument for controlling the led 0 </div><div class="gmail_default">          fad[0] = (msg.getInt(0));</div><div class="gmail_default">        }</div><div class="gmail_default">        //Serial.println (fad[0]);</div><div class="gmail_default">        break; // jump out of for-loop</div><div class="gmail_default">      }</div><div class="gmail_default">    }</div></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small">Then tried to print from within:</div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small"><div class="gmail_default">{</div><div class="gmail_default">  if (fad[2] >= 1){</div><div class="gmail_default">    for (int i = 0; i < 30; i += 2){</div><div class="gmail_default">      leds[i] = CHSV( fad[1], fad[0], fad[2]); </div><div class="gmail_default">    }</div><div class="gmail_default">    Serial.println (fad[1]);</div><div class="gmail_default">    Serial.println (fad[2]);</div><div class="gmail_default">  }</div><div class="gmail_default"><br></div><div class="gmail_default">in order to test whether the values are passing to this point in the code.  Nothing prints to the serial monitor when sending values from pd in this configuration.  I don't know exactly how to test whether the sketch is passing the values to the strip.  Any ideas?</div><div class="gmail_default"><br></div><div class="gmail_default">I will work on adapting/testing some of the other sketches now as well.</div><div class="gmail_default"><br></div><div class="gmail_default">Thanks again!</div><div class="gmail_default">Rick</div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 16, 2016 at 7:01 PM, Christof Ressi <span dir="ltr"><<a href="mailto:christof.ressi@gmx.at" target="_blank">christof.ressi@gmx.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Arghhh, please ignore my last arduino sketches. I had too little sleep and I got confused by all the braces (was too lazy to copy the code into a decent editor).<br>
<br>
You actually did your matching inside the right while loop ("while(SLIPSerial.available())"). But writing to the LEDs should happen outside because there's no need to update the LEDs for every OSC message. Better do it after all messages have been read. Attached is a 'corrected' and optimized version. Again, not tested.<br>
<br>
Are you sending all faders simultanously all the time? In that case it makes more sense to send a single OSC message, containing all the fader values as a list. Then you can dispatch every value via its index with getInt(INDEX)<br>
<br>
<br>
Gesendet: Freitag, 17. Juni 2016 um 01:28 Uhr<br>
Von: "Christof Ressi" <<a href="mailto:christof.ressi@gmx.at">christof.ressi@gmx.at</a>><br>
An: Pd-List <<a href="mailto:pd-list@lists.iem.at">pd-list@lists.iem.at</a>>, "Rick Snow" <<a href="mailto:ricksnow@gmail.com">ricksnow@gmail.com</a>><br>
<span class="">Betreff: Re: [PD] Pduino sysex vs. OSC advice<br>
<br>
Hi, I think there was a problem in your arduino code:<br>
 <br>
you did the testing against the address outside the while loop, so you will only have access to the latest message. The point of the while loop is that it will keep reading new OSC messages till the buffer is empty. So do your matching *inside* the while loop, right after a new message has been filled. Also, since your if clauses are mutually exclusive, you should do 'else if', so it will stop testing once you got 'true'. I attached a corrected version. You can try it and see if it works now. Unfortunately I couldn't test it myself.<br>
 <br>
I also did an optimized version, where I made an array fad[0] which gives you more flexibility and lets you do the matching with a simple for loop instead of chained if clauses. Again, not tested.<br>
 <br>
For this kind of application, you probably wouldn't need OSC. The question how to handle the bitshifting in a MIDI style protocol has already been answered in this thread ;-)<br>
<a href="https://lists.puredata.info/pipermail/pd-list/2016-06/115160.html" rel="noreferrer" target="_blank">https://lists.puredata.info/pipermail/pd-list/2016-06/115160.html</a><br>
 <br>
Chris<div class="gmail_default" style="font-family:verdana,sans-serif;font-size:small;display:inline">​tof​</div><br></span></blockquote></div></div></div>