RGB Led & Neopixel state / status or global virable
MacNite last edited by
a few month back I have posted about creating a macro to toggle LEDs on or off
This works fine. Now I want to reuse this code for an RGB LED (neopixel strip with 21 leds) wired to my Duet Mini 5+. I can configure the state of the LED without any problem and set colours I want. But I want a "simple" button on the PanelDue to switch them off and back on.
I just couldn't find the appropriate part of the object model - or is this just a part that is missing?
if state.GIVE_ME_LED_BRIGHNESS_LEVEL == 1 M150 S21 P0 else M150 S21 P255
A workaround for this would be to create a global variable but I think I missunderstood the concept for this. I tried to use:
global LED_state = true ; LED is on
global LED_state = 1 ; LED is on
Then I modified the "code" above to:
if LED_state == 1 ; or true if bool M150 S21 P0 else M150 S21 P255
But the DWC alway responds that the variable does not exist. Any idea on how to bugfix this? Maybe I am just missing a small puzzle piece again.
Thanks for your help.