LedButton

LedButton

A button that can tell when it's pressed or released, and can glow with a LED embedded in it.

Properties

ButtonState boolean read only

Returns true if the button is currently pressed, false otherwise.

ButtonDown boolean read only

A boolean flag which will be true only in the time tick the corresponding button changes its state to pressed.

ButtonUp boolean read only

A boolean flag which will be true only in the time tick the corresponding button changes its state to released.

InputSource InputSource

An InputSource to be used to trigger the button state.

LedState boolean

The lit/unlit state of the Led of this button.

LedColor color

The color of the Led of this button.

Events

LedButtonEvent : { ButtonDown boolean, ButtonUp boolean, Type string }

Triggered when the LedButton is pressed or released.
* ButtonDown is true if the button was just pressed.
* ButtonUp is true is the button was just released.
* Type is "LedButtonEvent".

In the Multitool

You can select different symbols to be printed on some sizes of buttons in the bottom screen of your Multitool.

Examples

You can tie the state of the button and the state of the LED together to make a button light up while it's pressed:

function update()
	-- LED state always being set to Button state every tick
	gdt.LedButton0.LedState = gdt.LedButton0.ButtonState
end

See also the Intro Tutorial video in the official Retro Gadgets YouTube channel for an example to control LED strips with Buttons.