0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ESP32-S2開発機でALLONE アローン PC用コントローラー ALG-PCCBKで遊ぶ(1)。(USBホスト)

0
Last updated at Posted at 2026-09-16

参考

いろいろ注意

  • 過去を見よ!!!

結果

image_original(155).jpg

Screenshot From 2026-09-17 07-18-14.png

Screenshot From 2026-09-17 07-20-40.png

image_original(156).jpg

Screenshot From 2026-09-17 07-21-52.png

IMG_8339.jpeg

プログラム


#include "EspUsbHost.h"

EspUsbHost usb;

void setup()
{
  Serial.begin(115200);
  delay(500);

  Serial.print("\n\nSTART\n\n");//caa45040
  delay(3000);//caa45040

  usb.onHIDInput([](const EspUsbHostHIDInput &input)
                 {
                   // en: Raw HID input fires before any keyboard/mouse/vendor-specific parsing.
                   // ja: Raw HID入力は、キーボード/マウス/ベンダー固有の解析前に通知されます。
                   espUsbHostPrint(input);
                 });

  usb.onDeviceConnected([](const EspUsbHostDeviceInfo &device)
                        {
                          Serial.print("connected: ");
                          espUsbHostPrint(device); });

  usb.onDeviceDisconnected([](const EspUsbHostDeviceInfo &device)
                           {
                             Serial.print("disconnected: ");
                             espUsbHostPrint(device); });

  //delay(2000);

  if (!usb.begin())
  {
    Serial.printf("usb.begin() failed: %s\n", usb.lastErrorName());
  } else {Serial.printf("usb.begin() OK\n");} //caa45040

  delay(1000);//caa45040

}

void loop()
{
  delay(1);//caa45040
}

おまけ

  • A

Screenshot From 2026-09-17 17-09-48.png

  • B

Screenshot From 2026-09-17 17-12-25.png

  • X

Screenshot From 2026-09-17 17-13-15.png

  • Y

Screenshot From 2026-09-17 17-13-56.png

Screenshot From 2026-09-17 17-16-21.png

Screenshot From 2026-09-17 17-17-48.png

  • <-

Screenshot From 2026-09-17 17-18-58.png

  • ->

Screenshot From 2026-09-17 17-20-19.png

  • 上から時計回りに0から7でボタンoffは、f

0,1,2,3,4,5,6,7,f



struct EspUsbHostHIDInput
{
  uint8_t address = 0;
  uint8_t interfaceNumber = 0;
  uint16_t vid = 0;
  uint16_t pid = 0;
  const char *manufacturer = "";
  const char *product = "";
  const char *serial = "";
  uint8_t subclass = 0;
  uint8_t protocol = 0;
  const uint8_t *data = nullptr;
  size_t length = 0;
};





void espUsbHostPrint(const EspUsbHostHIDInput &input, Print &out)
{
  out.printf("hid: address=%u vid=%04x pid=%04x iface=%u subclass=0x%02x protocol=0x%02x len=%u data=",
             input.address,
             input.vid,
             input.pid,
             input.interfaceNumber,
             input.subclass,
             input.protocol,
             static_cast<unsigned>(input.length));
  espUsbHostPrintHex(input.data, input.length, out);
  out.println();
}


0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?