1.. zephyr:code-sample:: usb-hid-keyboard 2 :name: USB HID keyboard 3 :relevant-api: usbd_api usbd_hid_device input_interface 4 5 Implement a basic HID keyboard device. 6 7Overview 8******** 9 10This sample application demonstrates the HID keyboard implementation using the 11new experimental USB device stack. 12 13Requirements 14************ 15 16This project requires an experimental USB device driver (UDC API) and uses the 17:ref:`input` API. There must be a :dtcompatible:`gpio-keys` group of buttons 18or keys defined at the board level that can generate input events. 19At least one key is required and up to four can be used. The first three keys 20are used for Num Lock, Caps Lock and Scroll Lock. The fourth key is used to 21report HID keys 1, 2, 3 and the right Alt modifier at once. 22 23The example can use up to three LEDs, configured via the devicetree alias such 24as ``led0``, to indicate the state of the keyboard LEDs. 25 26Building and Running 27******************** 28 29This sample can be built for multiple boards, in this example we will build it 30for the nRF52840DK board: 31 32.. zephyr-app-commands:: 33 :zephyr-app: samples/subsys/usb/hid-keyboard 34 :board: nrf52840dk/nrf52840 35 :goals: build flash 36 :compact: 37