key_check — Retrieve code of a pressed key
uint8 key_check();
Retrieve the code of the keyboard key that is currently being pressed, or return zero if no key is being pressed.
Code of the key that are being pressed.
If more than one key is being pressed, only the code of the first one is returned. |
#include <keyboard.gph> main { // Output the key code of pressed keys output_keycode(); } void output_keycode() { static uint8 previous_keycode; uint8 keycode; keycode = key_check(); if(keycode != previous_keycode) { if(keycode) { printf("Key Code: %02X", keycode); } previous_keycode = keycode; } return; }