Advertisement
rootiest

GCODE_VARIABLES.cfg

Aug 16th, 2022 (edited)
798
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.60 KB | None | 0 0
  1. # Gcode variables
  2.  
  3. # ADD_VARIABLE will add one to the value of the stored my_variable.
  4. # GCODE_VARIABLES is just there to store the variable value, but if run it will output that value to the console.
  5.  
  6. [gcode_macro ADD_VARIABLE]
  7. gcode:
  8.  {% set MY_VARIABLE = printer["gcode_macro gcode_variables"].my_variable %}
  9.   {% set NEW_VARIABLE = MY_VARIABLE + 1 %}
  10.   SET_GCODE_VARIABLE MACRO=gcode_variables VARIABLE=my_variable VALUE={NEW_VARIABLE}
  11.  
  12. [gcode_macro GCODE_VARIABLES]
  13. variable_my_variable: 0
  14. gcode:
  15.  {% set MY_VARIABLE = printer["gcode_macro gcode_variables"].my_variable %}
  16.   M118 {MY_VARIABLE}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement