pimoroni / keybow-firmware

Keybow Firmware for the Raspberry Pi Zero
Other
182 stars 67 forks source link

interrupt default.png for manual colour selection #86

Closed samBwise closed 2 years ago

samBwise commented 2 years ago

hi,

is it possible to interrupt the colour pattern for a manual colour when the key is pressed. when released the colour pattern continues?

i've attempted to turn off auto_lights, adjust the colour then turn them back on, by loading the default.png back in. but to no avail.

require "keybow"
-- Keybow MINI --
function setup()
   keybow.use_mini()
    --keybow.auto_lights(False)
    --keybow.clear_lights()
end

-- Key mappings --
function handle_minikey_00(pressed)

    if pressed then
    keybow.set_key("0", pressed)
    keybow.auto_lights(False)
        keybow.set_pixel(0, 0, 255, 0)
    keybow.set_pixel(1, 255, 0, 0)
    keybow.set_pixel(2, 255, 0, 0)
    keybow.auto_lights(True)
    load_new_pattern()
    else
        keybow.set_pixel(0, 0, 255, 0)
    end
end

function load_new_pattern()

    keybow.load_pattern('default')
end
samBwise commented 2 years ago

I resolved this by creating different patterns with inspiration from this blog.