Skip to main content

Keyboard Class

NuGet: GHIElectronics.TinyCLR.Devices.UsbClient
Assembly: GHIElectronics.TinyCLR.Devices.UsbClient
Namespace: GHIElectronics.TinyCLR.Devices.UsbClient

This device emulates a keyboard. You can set the state of any key, but only seven keys can be pressed at once.

public class Keyboard : RawDevice

Constructors​

Keyboard(UsbClientController usbClientController)​

public Keyboard(UsbClientController usbClientController) : this(usbClientController, new UsbClientSetting()

Creates a new keyboard with default parameters.

Keyboard(UsbClientController usbClientController, UsbClientSetting usbClientSetting)​

public Keyboard(UsbClientController usbClientController, UsbClientSetting usbClientSetting) : base(usbClientController, usbClientSetting)

Creates a new keyboard.

ParameterTypeDescription
usbClientControllerUsbClientControllerUsbClient controller.
usbClientSettingUsbClientSettingUsbClient setting

Methods​

Stroke(Key key)​

public void Stroke(Key key)

Presses and then releases the key.

ParameterTypeDescription
keyKeyThe key to press and release.

Stroke(Key key, int delay)​

public void Stroke(Key key, int delay)

Presses and then releases the key.

ParameterTypeDescription
keyKeyThe key to press and release.
delayintHow long to wait after the press before releasing.

Release(Key key)​

public void Release(Key key)

Releases the given key.

ParameterTypeDescription
keyKeyThe key to release.

Press(Key key)​

public void Press(Key key)

Presses the given key.

ParameterTypeDescription
keyKeyThe key to press.