Problems compiling KeyboardControler example code

Hi,

I was trying to test out my arduino Leonardo’s keyboard capabilities but when compiling the example program from Arduino Create it gives me errors and I have no idea how to solve them.

Here are the details:
-Operating system is Windows 10 home x 64.
-Browser is Chrome Version 58.0.3029.110 (64-bit)
-I am using a Leonardo clone
-Same code does not compile on offline IDE V 1.8.2

This is the output of my console when it gives me the “error: UOTGHS_HSTPIPCFG_PTYPE_INTRPT was not declared in this scope” message

WARNING: library USBHost-1.0.5 claims to run on (sam) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).

Generating function prototypes...

"/home/admin/builder/arduino-builder/packages/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -flto -w -x c++ -E -CC -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/admin/builder/arduino-builder/packages/cores/arduino/avr/cores/arduino" "-I/home/admin/builder/arduino-builder/packages/cores/arduino/avr/variants/leonardo" "-I/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src" "/tmp/429540511/sketch/KeyboardController.ino.cpp" -o "/tmp/429540511/preproc/ctags_target_for_gcc_minus_e.cpp"

"/home/admin/builder/arduino-builder/tools/ctags/5.8-arduino11/ctags" -u --language-force=c++ -f - --c++-kinds=svpf --fields=KSTtzns --line-directives "/tmp/429540511/preproc/ctags_target_for_gcc_minus_e.cpp"

Compiling sketch...

"/home/admin/builder/arduino-builder/packages/tools/avr-gcc/4.9.2-atmel3.5.4-arduino2/bin/avr-g++" -c -g -Os -w -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD -flto -mmcu=atmega32u4 -DF_CPU=16000000L -DARDUINO=10611 -DARDUINO_AVR_LEONARDO -DARDUINO_ARCH_AVR -DUSB_VID=0x2341 -DUSB_PID=0x8036 '-DUSB_MANUFACTURER="Unknown"' '-DUSB_PRODUCT="Arduino Leonardo"' "-I/home/admin/builder/arduino-builder/packages/cores/arduino/avr/cores/arduino" "-I/home/admin/builder/arduino-builder/packages/cores/arduino/avr/variants/leonardo" "-I/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src" "/tmp/429540511/sketch/KeyboardController.ino.cpp" -o "/tmp/429540511/sketch/KeyboardController.ino.cpp.o"

Using library USBHost-1.0.5 at version 1.0.5 in folder: /home/admin/builder/arduino-builder/latest/USBHost-1.0.5

In file included from /home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/KeyboardController.h:22:0,

from /tmp/923660864/KeyboardController/KeyboardController.ino:17:

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h: In member function 'virtual void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t, uint32_t, uint32_t, uint32_t, const USB_ENDPOINT_DESCRIPTOR*)':

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h:474:62: error: 'UOTGHS_HSTPIPCFG_PTYPE_INTRPT' was not declared in this scope

pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK);

^

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h:474:93: error: 'UOTGHS_HSTPIPCFG_PTOKEN_IN' was not declared in this scope

pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK);

^

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h:474:151: error: 'UOTGHS_HSTPIPCFG_PBK_1_BANK' was not declared in this scope

pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK);

^

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h: In instantiation of 'uint32_t HIDBoot<BOOT_PROTOCOL>::Release() [with unsigned char BOOT_PROTOCOL = 1u; uint32_t = long unsigned int]':

/tmp/923660864/KeyboardController/KeyboardController.ino:89:1: required from here

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h:500:54: error: 'UHD_Pipe_Free' was not declared in this scope

UHD_Pipe_Free(epInfo[epInterruptInIndex].hostPipeNum);

^

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h: In instantiation of 'void HIDBoot<BOOT_PROTOCOL>::EndpointXtract(uint32_t, uint32_t, uint32_t, uint32_t, const USB_ENDPOINT_DESCRIPTOR*) [with unsigned char BOOT_PROTOCOL = 1u; uint32_t = long unsigned int]':

/tmp/923660864/KeyboardController/KeyboardController.ino:89:1: required from here

/home/admin/builder/arduino-builder/latest/USBHost-1.0.5/src/hidboot.h:474:178: error: 'UHD_Pipe_Alloc' was not declared in this scope

pipe = UHD_Pipe_Alloc(bAddress, epInfo[index].deviceEpNum, UOTGHS_HSTPIPCFG_PTYPE_INTRPT, UOTGHS_HSTPIPCFG_PTOKEN_IN, epInfo[index].maxPktSize, 10, UOTGHS_HSTPIPCFG_PBK_1_BANK);

^

exit status 1

-The arduino Leonardo is plugged into a standard USB 2.0

-The sketch is the example code from the create library under USB Host, KeyboardController

I hope this is enough info.

Here's the problem:

WooD0331: WARNING: library USBHost-1.0.5 claims to run on (sam) architecture(s) and may be incompatible with your current board which runs on (avr) architecture(s).

From https://www.arduino.cc/en/Reference/USBHost:

The USBHost library allows an Arduino Due board to appear as a USB host

Which actually is an incomplete statement because there is a version of that library also for the SAMD boards.

It's always a good idea to read through the error output for useful information.

You can use the Keyboard library with your Leonardo: https://www.arduino.cc/en/Reference/MouseKeyboard

Thanks for the help on that. Now if got to figure out how to use it properly