Gcode for turning on LED



  • This should be an easy one for the Creality team. What is the gcode for turning the LED light on or off? I would like to insert it into the CURA printer setting so that it is on automatically when printing then to shut off when the printing is done. Thanks 😉



  • Does anyone have the voltage, wattage and type of led or a hack to change that stupid blue led to a white one with some solid lumens on the CR-6-SE. I can only find light bars and one person on Etsy selling their white bulb hot end lights but no hacks to change it or any mention of what LED is able to be used for the hot end.

    Thanks In Advance



  • Oops...

    Warning!!! Do a "G28 X Y" before doing any x and y moves! (I edited my code below)

    Usually the bed and x-axis can easily be moved when the printer is not active. So y second run of this the y-axis hit the end. Ew, gross!!!



  • @ncbob The blink Idea is great.

    I added some LED blinking right before there is a HOME or WIPE routine and OFF during the routines. This way the LED is on whenever there is idle time so I can prep the bed if I want too.

    If anyone is interested, here is my code:

    ;;;;; START HEATING BED ;;;;;
    
    M42 P6 S255      	  	; Tool LED on
    G91 				; Relative positioning
    G1 Z2.0 			; move up a bit, in case there is still a print on the bed
    G90 				; Absolute positionning
    G28 X Y			; ***EDITED*** added an X and Y homing command before the first X and/or Y move
    G1 X5.0 Y230.0 F5000.0 		; Move bed out for bed and glue prep
    M140 S{material_bed_temperature}	; start preheating the bed WITHOUT wait
    M109 S110 T0 			; start heating hotend and wait until near typical ABL temp
    M104 S{material_print_temperature} T0	; continue heating to target temp
    M42 P6 S0 			; LED off
    G4 S1 				; pause 1 sec
    M42 P6 S255 			; LED on
    G4 S1 				; pause 1 sec
    M42 P6 S0 			; LED off
    G28 				; Home (tool should be near ABL temp. by now)
    G1 X5.0 Y230.0 Z2.0 F5000.0	; Move bed back out
    M42 P6 S255 			; LED on
    M109 S{material_print_temperature} T0	; continue heating and WAIT
    
    ;;;;; RESET AND WIPE NOZZLE ;;;;;
    
    M420 S1 Z10			; reinstates Bed Leveling State with z fade out
    M42 P6 S0 			; LED off
    G4 S1 				; pause 1 sec
    M42 P6 S255 			; LED on
    G4 S1 				; pause 1 sec
    M42 P6 S0 			; LED off
    G92 E0 				; Reset Extruder
    G1 Z2.0 F3000 			; Move Z Axis up
    G1 X5.0 Y200 Z0.28 F5000.0 	;Move to start position (modified to reverse y direction)
    G1 X5.0 Y20 Z0.28 F1500.0 E15 	;Draw the first line
    G1 X5.5 Y20 Z0.28 F5000.0 	;Move to side a little
    G1 X5.5 Y200 Z0.28 F1500.0 E30 	;Draw the second line
    G92 E0 				;Reset Extruder
    G1 Z2.0 F3000 			;Move Z Axis up
    
    M42 P6 S255			; LED on
    M117 Printing…
    


  • @spauliszyn That's one of the reasons I like Octoprint, you can put in Gcode to run when it fails or pauses, but unfortunately there's not a blink so what you'll need to do is something like this and just repeat it a bunch.

    M42 P6 S0
    G4 S1
    M42 P6 S255
    G4 S1



  • Wow @ncbob, good find! Works great. I have it in my start and end code so that the LED will be on when the printer is starting to warm up even. Now I need to figure a way to have it pulse when the printer is paused or failed.



  • @S7EN @spauliszyn ok, someone on the Facebook group up posted how to do it, I haven’t tried it yet but I will after I sleep some 😉

    M42 P6 S0 ; led off

    M42 P6 S255 ; led on



  • Is there any other option to switch the light remotely? Maybe with octoprint?



  • @admin Can you please add it to the official suggestion list? The whole reason for Marlin g-code is that the printer can be controlled and automated by other devices. In your defence I do not see a g-code for a hot-end light. But you can always add a custom code, you are allowed you know.



  • Dear @spauliszyn

    Thanks for your support. I have checked with our engineer, it seems there doesn't have this kind of gcode to this function. Sorry about that.


Log in to reply
 

Copyright © 2020 Shenzhen Creality 3D Technology Co., Ltd All Rights Reserved.