Quick Sign In:  

Forum: Old versions

Topic: Problem with led script

This topic is old and might contain outdated or incorrect information.

Dodge57PRO InfinityMember since 2009
Hello,

For the noavation Launchpad Mk2 i want to script the leds in two pages. Here my script :
<map value="RGB_PAD_8_1" action="var '$PAGE' 0 ? sampler 1 play ? blink 300ms ? constant '129,255,129' : constant '0,128,0' : constant '0,20,0' : constant '129,255,129' : var '$PAGE' 1 ? deck 1 loaded ? blink 200ms ? constant '255,255,70' : constant '255,255,150' : constant '0,20,0' : constant '0,20,0' " />

RGB_PAD_8_1 is the name of the led.
constant 'xxx,xxx,xxx' is a color
If I want to see the page 0, if I start the sampler 1, the led blink correctly and all the other leds are correct.
But if I select the page 1, I have some colors of the page 0 and I don't know why ?!

Can you help me ?
 

Posted Sat 05 Mar 16 @ 9:38 pm
Dodge57 wrote :

<map value="RGB_PAD_8_1" action="var '$PAGE' 0 ? sampler 1 play ? blink 300ms ? constant '129,255,129' : constant '0,128,0' : constant '0,20,0' : constant '129,255,129' : var '$PAGE' 1 ? deck 1 loaded ? blink 200ms ? constant '255,255,70' : constant '255,255,150' : constant '0,20,0' : constant '0,20,0' " />


<map value="RGB_PAD_8_1" action="var_equal '$PAGE' 0 ? sampler 1 play ? blink 300ms ? constant '129,255,129' : constant '0,128,0' : constant '0,20,0' : var_equal '$PAGE' 1 ? deck 1 loaded ? blink 200ms ? constant '255,255,70' : constant '255,255,150' : constant '0,20,0' : var_equal '$PAGE' 2 ?..." />

 

Posted Wed 09 Mar 16 @ 10:59 am
First mistake was that you need to compare the value.
Hence instead of var you need to use var_equal

Second mistake was that you instruct your queries to show an "extra" color:
Your structure:

If page=0
__ if sampler 1 play
____if led blinks state on
______color 1
______(else led blink state off)
____color 2
____(else sampler 1 does not play)
__color 3
__(else page is not 0)
color 4
Anything after this point never evaluates true since your last statement (set color) evaluates true when page is not 0

Correct structure is:
If page=0
__ if sampler 1 play
____if led blinks state on
______color 1
______(else led blink state off)
____color 2
____(else sampler 1 does not play)
__color 3
__(else page is not 0)
if page=1
...

page=1 can evaluate true in this case since it's executed on the page is not 0 step of previous code block. :)
 

Posted Wed 09 Mar 16 @ 11:11 am
Dodge57PRO InfinityMember since 2009
I forgot to thank you. Thank you, it works great !!
 

Posted Sun 03 Apr 16 @ 8:44 am


(Old topics and forums are automatically closed)