So i am fairly new to klipper, i got the case lights setup on klipper using a fan port. I cant seem to find any information on possibly adding that into my start config so it will turn the lights on when i start a print.
This is what i am running to control the lights right now.
[output_pin LED_pin]
pin: PE5
pwm: True
value: 0
cycle_time: 0.010
Hello @Maj.D.Hurtz !
You could use a Gcode for that :
[output_pin LIGHT_pin]
pin: PE5
pwm: False
value: 0
[gcode_macro M355]
gcode:
{% set S = params.S|default(1)|int %}
#default_parameter_S=1
SET_PIN PIN=LIGHT_pin VALUE={S}
M355 S0 turns light off
M355 S1 turns light on
Awesome Buddy! Thank You! It worked like a champ.
1 Like
hcet14
July 30, 2023, 1:14pm
4
Hi Eddy,
one question. How do you know Klipper supports M355?
G-code - RepRap isn’t explicit. Do the three ?s
???
inplicate there might be a possibility, that this G-code command might work with Klipper?
G-Codes - Klipper documentation Klipper documentation doesn’t mention M355.
What is your source to know M355 is supported by Klipper?
Kind regards, hcet14
He built M355 via macro or what do you want to know exactly?
I’m controlling LEDs in my CoreXY as well but have to look how I do it there.
1 Like
@hcet14
M355 is the Marlin gcode for enclosure light.
And then as @LifeOfBrian said:
You can create own gcode macros in Klipper.
https://www.klipper3d.org/Command_Templates.html
hcet14
July 30, 2023, 1:48pm
7
@LifeOfBrian & @EddyMI3D
Thanks, sorry for that stupid question from me.
Kind regards, hcet14
1 Like
This is how I did it with a LED strip powered with a MOSFET via Configuration reference - Klipper documentation
Definition of the LED itself:
[led LED_Bauraum]
white_pin: PE6
And the respective macro to control it:
[gcode_macro Bauraumlicht]
gcode:
SET_LED LED=LED_Bauraum WHITE={params.VALUE|default(1)|float}
And then you just call it via
Bauraumlicht
to turn it on and
Bauraumlicht VALUE=0
to turn it off and with 0.0 - 1.0 you can change its intensity.
And as you can guess and read in the documentation you can control full RGBW-LEDs with this without the need of a couple of SET_PIN
calls.