Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    RGB Led & Neopixel state / status or global virable

    Scheduled Pinned Locked Moved
    Gcode meta commands
    1
    1
    236
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • MacNiteundefined
      MacNite
      last edited by

      Hey guys,

      a few month back I have posted about creating a macro to toggle LEDs on or off
      old post

      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
      

      or

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

      CorEssentials on GitHub | Instructables Profile | Thingiverse Profile

      1 Reply Last reply Reply Quote 0
      • First post
        Last post
      Unless otherwise noted, all forum content is licensed under CC-BY-SA