Keybow mini - copy-past shortcuts problem

Hi everyone,
i’m completely newbie on programing…
I’ve bought the Keybow mini and i’ve followed the macros tutorial.

The goal is to create 3 shortcuts : save/copy/paste
Below the code :

function handle_minikey_00(pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
        keybow.tap_key("v", pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
    if pressed then
        keybow.set_pixel(0, 255, 0, 0)
    else
        keybow.set_pixel(0, 0, 0, 0)
    end
end

function handle_minikey_01(pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
        keybow.tap_key("c", pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
    if pressed then
        keybow.set_pixel(1, 0, 255, 0)
    else
        keybow.set_pixel(1, 0, 0, 0)
    end
end

function handle_minikey_02(pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
        keybow.tap_key("s", pressed)
        keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
    if pressed then
        keybow.set_pixel(2, 0, 0, 255)
    else
        keybow.set_pixel(2, 0, 0, 0)
    end
end

this issue occurs when pressing the key 00 for pasting (a text for eg), it pasts twice.
first it pasts the text when the key is pressed and secondly when the key is released.

How can I fixe it please ?
thanks in advance for your help

ok after a few search, below the correct code.
(the one on the tutorial is wrong)

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_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
keybow.tap_key(“v”, pressed)
keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
keybow.set_pixel(0, 255, 0, 0)
else
keybow.set_pixel(0, 0, 0, 0)
end
end

function handle_minikey_01(pressed)
if pressed then
keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
keybow.tap_key(“c”, pressed)
keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
keybow.set_pixel(1, 0, 255, 0)
else
keybow.set_pixel(1, 0, 0, 0)
end
end

function handle_minikey_02(pressed)
if pressed then
keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_DOWN)
keybow.tap_key(“s”, pressed)
keybow.set_modifier(keybow.LEFT_CTRL, keybow.KEY_UP)
keybow.set_pixel(2, 0, 0, 255)
else
keybow.set_pixel(2, 0, 0, 0)
end
end

Which tutorial is it that’s got the wrong code? The “Using Macros” one on learn looks to have the key tap stuff correctly wrapped inside if pressed blocks?

Yes the code came from this page that I’ve been inspired.
I’ve copy-past and it doesn’t work.
after talking with a friend more comfortable on programming, he told me how to fix the code :