KEYLED mask Mask - is a variable/constant which specifies the LEDs to use.


This command is deprecated, please consider using the kbled command instead.

Set/clear the keyboard LEDs This command is used to control the LEDs on a computer keyboard (connected directly to the PICAXE - not the keyboard used whilst programming). The mask value sets the operation of the LEDs. Mask is used as follows:

Bit 0 Scroll Lock (1=on, 0=off)
Bit 1 Num Lock (1=on, 0=off)
Bit 2 Caps Lock (1=on, 0=off)
Bit 3-6 Not Used
Bit 7 Disable Flash (1=no flash, 0=flash)

On reset mask is set to 0, and so all three LEDs will flash when the 'keyin' command detects a new key hit. This provides the user with feedback that the key press has been detected by the PICAXE.

This flashing can be disabled by setting bit 7 of mask high. In this case the condition of the three LEDs can be manually controlled by setting/clearing bits 2-0.

Effect of Increased Clock Speed

This command will only function at 4MHz.

Applies To:
18A, 18M, 18X, 20X2, 28X, 28X1, 28X2, 40X, 40X1, 40X2
See Also:
Related Create:

Using 'kbled'

This program repeatedly sets the keyboard LEDs on and then turns them all off again.

Code Example:
main:	keyled %10000111	; all LEDs on
	pause 500		; pause 0.5s
	keyled %10000000	; all LEDs off
	pause 500		; pause 0.5s
	goto main		; loop
Copy Code Submit an Example

Submit Your Own Code!

You must be logged in to submit code examples. Login now.


  • Login to leave a comment.