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). 

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. 

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)


Gesendet: Freitag, 17. Juni 2016 um 01:28 Uhr
Von: "Christof Ressi" <christof.re...@gmx.at>
An: Pd-List <pd-list@lists.iem.at>, "Rick Snow" <ricks...@gmail.com>
Betreff: Re: [PD] Pduino sysex vs. OSC advice

Hi, I think there was a problem in your arduino code:
 
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.
 
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.
 
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 ;-)
https://lists.puredata.info/pipermail/pd-list/2016-06/115160.html
 
Christof
 

Gesendet: Donnerstag, 16. Juni 2016 um 22:58 Uhr
Von: "Martin Peach" <chakekat...@gmail.com>
An: "pd-list@lists.iem.at" <pd-list@lists.iem.at>
Betreff: Re: [PD] Pduino sysex vs. OSC advice

On Thu, Jun 16, 2016 at 11:35 AM, Rick Snow <ricks...@gmail.com> wrote:

​Thanks again Christof for pointing me in a promising direction.  I have been 
working with the OSC tagging via slipenc and slipdec.
 
As of now I have fairly reliable communication between PD and the Arduino 
sketch using a version the patch you provided.  I am able to reliably send 
messages and the sketch responds as I expect most of the time.  However, when 
sending several faders simulaneously I get some glitching.  Right now I am 
wondering if it has something to do with using OSC instead of the raw slip 
packages.  I do get this message in the pd console but I'm not sure that it 
relates to the glitching: "slipdec: input packet longer than 1006" 
 
 
The default SLIP packet length is set n the source:
#define MAX_SLIP 1006 /* maximum SLIP packet size */
You can set the maximum packet length by giving [slipdec] a creation argument, 
e.g.  [slipdec 32768].

Martin
 _______________________________________________ Pd-list@lists.iem.at mailing 
list UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list[https://lists.puredata.info/listinfo/pd-list]_______________________________________________
 Pd-list@lists.iem.at mailing list UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list[https://lists.puredata.info/listinfo/pd-list]

Attachment: _60_LEDs_OSC_HueSat_evenOdd_korr2.ino
Description: Binary data

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to