hello! im new at arduino i just wanna make two button macro key with arduino leonardo, one "CTRL+K" another is "Q" i can make it work separately but can not combine two codes. thank you in advance.
Your code for 'Ctrl-K' is going to wait until Pin 2 goes HIGH. While it is waiting, Pin 3 is never checked.
You should look at the StateChangeDetection example to see how to perform actions when a button goes from Unpressed to Pressed or from Pressed to Unpressed. That will get rid of all of the delays and wait loops.