Home Contents | # keyboard:setButton | Keyboard | Core4 Lua Event System

## SYNOPSIS

#include <lua/sidekick-pins.lh>
#include <lua/scancode.lh>

1. kbdhandle:setButton(button, pin, scancode)
2. kbdhandle:setButton(button)

## DESCRIPTION

The V4 Controller has support for up to sixteen pusbuttons that are directly connected to an input pin.

The button parameter numbers the button from 0 ··· 15. This number is reported within input events on the keyboard handle.

The value of pin indicates the pin number of the button. When missing, the button is disabled.

The value of scancode will be reported in the key press event when the button is pressed. To assign a generic scancode, use SCANCODE(KEY_xxx), using one of the scancode definitions from lua/scancode.lh

The second form of the command, with no further parameters, disables the specified button.

## NOTES

The V4½ controller does not support pushbuttons.

## EXAMPLE

An example use is a rotary encoder on inputs 0 and 1 with the button on input 2.

> >
kbdhandle:setWheel(0, SKIO_IN0, SKIO_IN1, SCANCODE(KEY_DOWN), SCANCODE(KEY_UP), 1) kbdhandle:setButton(0, SKIO_IN2, SCANCODE(KEY_ENTER))

## SEE ALSO

keyboard:setWheel