Keyboard Library - Using ALT keycodes trouble

Hey all,

I've scavenged a cash register keyboard and have turned it into a hotkey board that plugs into my PC (windows) via usb. I'm using a Pro Micro and the Keyboard library to emulate presses.

I've successfully set keys to open tabs (CTRL + t), open explorer (WIN + e), but I haven't been able to get ALT keycodes to work. I use a lot of greek letters for lab reports so would like to have a single key to type the keycode. For example, ALT + 234 is Ω (omega). When testing at KeyTest. Keyboard test online , all the keys light up as expected. I just can't get it to create the character!

Here's some of the attempts I've made: (The delays were added while testing to ensure the computer gets each key press)

Keyboard.press(KEY_LEFT_ALT);
delay(100);
Keyboard.print("2");
delay(100);
Keyboard.print("3");
delay(100);
Keyboard.print("4");
Keyboard.releaseAll();
Keyboard.press(KEY_LEFT_ALT);
delay(100);
Keyboard.press('2');
delay(100);
Keyboard.release('2');
Keyboard.press('3');
delay(100);
Keyboard.release('3');
Keyboard.press('4');
delay(100);
Keyboard.releaseAll();

I've made many more attempts but these are my two main ones.
I am wondering if maybe the library has an issue with alt keycodes specifically for some reason. ALT+F4 works fine, and every other shortcut as well. Perhaps since this shortcut requires you to hold ALT while you press and release some numbers?

The entire code can be viewed at: GitHub - fwacer/hotkeyboard: A custom hotkey keyboard made out of an old cash register's keyboard

Any insight would be great!

I'm not a Windows user but as far as I know these Alt key combinations work only if you use the keypad to enter the number. The Keyboard.h file doesn't have the necessary defines for keypad codes, so you have to add them in your sketch:

#define KP_0  0xb0
#define KP_1  0xb1
#define KP_2  0xb2
#define KP_3  0xb3
#define KP_4  0xb4
#define KP_5  0xb5
#define KP_6  0xb6
#define KP_7  0xb7
#define KP_8  0xb8
#define KP_9  0xb9

then use these to make the press and release calls:

Keyboard.press(KEY_LEFT_ALT);
delay(100);
Keyboard.press(KP_2);
delay(100);
Keyboard.release(KP_2);
Keyboard.press(KP_3);
delay(100);
Keyboard.release(KP_3);
Keyboard.press(KP_4);
delay(100);
Keyboard.releaseAll();

I didn't test this code (I said that I don't use Windows) so it's just theoretical that it might work.

Thanks, you're totally right! It didn't occur to me that I could only use the number pad for alt keycodes.