Script for using DotStar as status indicator LED



  • Hello there,

    I am coming from a Marlin background but plan to use RRF for my next build in conjunction with a Duet3.
    And since the Duet3 supports DotStar LED strips I was wondering if someone already took advantage of that and wrote a script that uses this as a Status LED (similar to Marlins Status LED using Neopixels).
    I don't have the hardware yet and haven't written any script for RRF yet but I would like to get into it.
    But for now I would like to know whether someone already created a script like this on which I can build upon.

    I would imagine something like this:
    Printer ready: green
    Bed Heating: yellow
    Hotend Heating: red
    Printing: blue
    Print finished: turquoise
    Wait for confirmation (i.e. part removal) to turn green again.
    Advanced version: It would of course be nice to have a color transition for heating the bed from yellow (20°C) to orange (target) and for the nozzle from orange (20°C) to red (target) LED by LED and maybe from blue to turquoise for print progress

    Any help is greatly appreciated



  • The very latest firmware has a "daemon.g" that is executed periodically (every 1/2 second, if I recall). It also has a object model that has all the status required for what you are proposing.

    Hook up a dotstar, configure it, and then something like:

    if state.status = "idle"
    M150 R0 U0 B128 Y31 S100 F0 ; Set all 100 leds green.
    if heat.heaters[0].current < 30 ; Bed heating?
    M150 R255 U255 B0 Y31 S100 F0 ; Set all 100 leds yellow.

    and so forth. Probably will require a little bit more elaborate 'and' logic than shown above.



  • Is there some document where I can find all the objects and their attributes?
    And can I code as I would in whatever IDE: Can I do loops and variables for example for the LED by LED logic so that I can define the number of LEDs at the top and than work with that variable?
    Or are their restrictions and only few operators like 'if' you can work with?



  • Variables not yet implemented, coming soon...

    Object model can be explored with M409 in the web console. Start with bare M409, then M409 K"key" and drill down via the keys.

    More doc on conditional G-Code: https://duet3d.dozuki.com/Wiki/GCode_Meta_Commands



  • As I said I don't have the hardware yet so I have to wait until I get it to start exploring hands on 😄



  • All you sould need is a strip. Amazon overnight man... get a move on... (kidding, sort of) 🙂



  • @Danal and a Duet3... maybe? 😄



  • Ah... gotcha!



  • Would this be possible on the Duet 2 Maestro ?

    Asking as Im a complete noob on RRF



  • Not directly. Only Duet3 hardware supports direct drive of dotstar or neopixel.

    With Duet 2, you'd have to drive a pin that switched a controller that, in turn, drove the LEDs.