I wrote a macro
[delayed_gcode rainbow]
gcode:
advance_led_animation
UPDATE_DELAYED_GCODE ID=rainbow DURATION=.1
[gcode_macro advance_led_animation]
variable_r_min: 0
variable_g_min: 0
variable_b_min: 0
variable_r_max: 1
variable_g_max: 1
variable_b_max: 1
gcode:
{% set pixel_count = 16 %}
{% set r_step = (r_max-r_min)/pixel_count %}
{% set g_step = (g_max-g_min)/pixel_count %}
{% set b_step = (b_max-b_min)/pixel_count %}
{% for pixel in range(pixel_count) %}
{% if pixel == 16 %}
{% set transmit = 1 %}
{% else %}
{% set transmit = 0 %}
{% endif %}
SET_LED LED=bridge_light RED={ printer["bridge_light"].color_data[pixel + 1].R } GREEN={ printer["bridge_light"].color_data[pixel + 1].G } BLUE={ printer["bridge_light"].color_data[pixel + 1].B } INDEX={ pixel } TRANSMIT={ transmit } SYNC=0
{% endfor %}
[neopixel bridge_light]
pin: PF8
chain_count: 16
initial_red: 1.0
initial_blue: 1.0
initial_green: 1.0
That doesn’t work
!! Error evaluating ‘gcode_macro advance_led_animation:gcode’: UndefinedError: ‘instance object’ has no attribute ‘bridge_light’