coding help for passing variables via OSC to fastled library

Hi!

I am trying to figure out how to use OSC messaging (using OSCMessage.h and SLIPEncodedSerial.h) to control addressable led strips (using the FastLED library). It is likely that I am making some silly mistake but I just can't get the behavior to respond to the messages as I expect. I was able to upload the FastLED demo sketches and they behaved as expected.

Now I have a working sketch that takes integers 0-60 with an OSC tag /fad and reliably turns the leds on the strip blue in succession as I change the values sent via OSC in real time: http://pastebin.com/M1P9iqcW

I then tried to create a sketch that would allow me to turn on and off each led individually with a 0 or 1 integer tagged for each led /ld0, /ld1, /ld2: http://pastebin.com/d8a4zFc6

This kind of worked but the behavior I expected from "0" (turn off the led) and "1" (turn on the led) seem reversed for the most part. This is the general behavior I'm getting:

action: serial print: LEDs:

“/ld0 1” — “/ld0 0” 1 0 goes pink 0

“/ld0 1” 1 0 goes black “/ld0 0” 0 0 goes pink

“/ld0 1” 1 0 goes black “/ld0 0” 0 0 goes pink

“/ld1 1” - 0 goes black “/ld1 0” 1010 1 goes green

“/ld1 1” 1 1 goes black “/ld1 0” 0 1 goes green

“/ld1 1” 1 1 goes black “/ld1 0” 0 1 goes green

“/ld2 1” 1 1 goes black “/ld2 0” 0 2 goes blue

“/ld2 1” 1 2 goes black “/ld2 0” 0 2 goes blue

“/ld2 1” 1 2 goes black “/ld2 0” 0 2 goes blue

If I leave one or more of the leds on then messages meant for the other leds will sometimes turn the already lit led off before turning on the desired led....

Any advice is greatly appreciated! :P :P :P

Fixed it!

I needed to move the messaging test before the variable test in the loop... now to figure out how to make a method out of both the message test and the variable test.