"light toggle" does not work

Friends. I want to run the light control macro. “on” and “off” buttons work. I can’t run “light toggle”. This may not be an obstacle in terms of usage. But I want to add a physical button to my printer and turn the lights on and off with a single button. I couldn’t find where I made a mistake. I need your help.
light_toggle
light_control.txt (1.4 KB)

For you was greeted with this text when you opened this thread:


[DELETE_ME_AFTER_READING]
This category is for posting working macros only. It is not intended for support or questions.
[/DELETE_ME_AFTER_READING]


I’ll move your thread.

2 Likes

I am really sad. I couldn’t understand it because it’s not my native language. Thank you.

1 Like

The only thing I can think of to try would be something like this:

[gcode_macro lights_off]
gcode:
    SET_PIN PIN=caselight VALUE=0|int
 
[gcode_macro lights_on]
gcode:
    SET_PIN PIN=caselight VALUE=20|int
 
[gcode_macro lights_toggle]
gcode:
    {% if (printer["output_pin caselight"].value)|int == 20 %}
        lights_off
    {% else %}
        lights_on
    {% endif %}

theophile thanks. :pray:I somehow got it working today by chance. everything is okay right now. I will definitely try the arrangement you wrote. Thank you again for your help.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.