romu-usb-hid-keyboard.ino

Romu USB Development Board (RP2354A) · File : romu-usb-hid-keyboard.ino · Language : C/C++ (Arduino) · Use case : Transformer la carte Romu en un clavier USB HID qui tape une phrase prédéfinie.

Configures the board as a HID keyboard device that sends text when a button is pressed.

Requires the HID-Project library. The Romu board plugs directly into USB. The code uses integrated buttons. Ensure the HID library is installed in the Arduino IDE. Ideal for keyboard shortcuts or simple authentication.

romu-usb-hid-keyboard.ino

#include "Arduino.h"
#include "HID-Project.h"

// Romu has buttons, let's assume Button 1 is on GPIO 12 (placeholder)
#define BUTTON_PIN 12

void setup() {
  pinMode(BUTTON_PIN, INPUT_PULLUP);
  Keyboard.begin();
}

void loop() {
  if (digitalRead(BUTTON_PIN) == LOW) {
    delay(50); // Debounce
    if (digitalRead(BUTTON_PIN) == LOW) {
      Keyboard.print("Hello from Romu!");
      while (digitalRead(BUTTON_PIN) == LOW) {
        delay(10); // Wait for release
      }
    }
  }
}

← Back to the board