This command is deprecated, please consider using the kbin command instead.
Wait until a new keyboard press is received.
This command is used to wait for a new key press from a computer keyboard (connected directly to the PICAXE - not the keyboard used whilst programming, see the keyled command in section 2 of the manual for connection details). All processing stops until the new key press is received.
The value of the key press received is placed in the predefined variable 'keyvalue'. Note the design of the keyboard means that the value of each key is not logical, each key value must be identified from the table listed in manual 2. Some keys use two numbers, the first $E0 is ignored by the PICAXE and so keyvalue will return the second number. Note all the codes are in hex and so should be prefixed with $ whilst programming. The PAUSE and PRNT SCRN keys cannot be used reliably as they have a special long multi-digit code. Also note that some keys may not work correctly when the 'Nums Lock' LED is set on with the keyled command. The sample file 'keyin.bas' (installed in the \samples folder) provides details on how you can convert the key presses into ASCII characters by means of a look up table.
After using this command you may have to perform a hard reset to download a new program to the microcontroller.
Effect of Increased Clock Speed
This command will only function at 4MHz.
Keyboard toggling a LED
When a key is pressed which has keycode value $25 a LED on output B.1 is turned on, and turned off when a key is pressed which has keycode value $45.
Submit Your Own Code!
You must be logged in to submit code examples. Login now.