How do I programmatically change button color on VSN1 module? | Intech Studio
💬 general Grid

How do I programmatically change button color on VSN1 module?

goatbamf
goatbamf · · 3 replies

I have a VSN1 module and would like to have a button be red when it's on, and green when it's off.

if self:button_state() == 127 then
    led_color(self:element_index(), 1, 255, 0, 0)
else
    led_color(self:element_index(), 1, 0, 255, 0)
end

led_value(self:element_index(), 1, 255)

What am I doing wrong here? Does this API just not work on VSN1?

I've also removed the simple color action just so there aren't conflicts. The code also doesn't work using the element API either:

element[self:element_index()]:led_color(1, 255, 0, 0)

Results in error.

Replies (3)

Greg-Orca Greg-Orca ·

self:element_index() is not correct here because the endless LEDs apply an offset. Use self:element_index() + 10 instead.
Or simply use a fixed color like this:

Screenshot_2025-12-15_at_10.44.36.png
remix73 remix73 ·

I have just spent the whole evening with this exact same issue and just came across your post

goatbamf goatbamf ·

Thank you @user. That does it. Hopefully this info makes it into the official documentation soon.

Discord

View on Discord

This post is from the Intech Studio Discord community.

Open thread →