

Those examples are contained under File > Examples > 09.USB. Does your sketch include the line ‘#include ’? you have accidently opened up an example for a board that supports USB natively. If you get the error: ‘Keyboard’ not found. The serial monitor should now output some text whenever you hit a key on the keyboard. Open a serial monitor from within the Arduino IDE: Tools > Serial Monitor. Reset the Arduino Mega 2560.

Plug a Keyboard into the USB shield, upload the sketch. Restart the Arduino IDE.Īfter starting the Arduino IDE, select File > Examples > USB Host Shield Library 2.0 > HID > USBHIDBootKbd. Point the dialog to the folder into which the repository got cloned and finish the import. Open the Arduino IDE and select Sketch > Include Library > Add. To run an example, it is necessary to install the library into your Arduino IDE. On the software side, the github repository conains the library including examples for the SainSmart USB host shield. I tested it without modifying the hardware and my Arduino Mega 2560 and the SainSmart USB Host shield still work. The shield can be plugged in to a Arduino Mega 2560. The SainSmart USB Host shield contains a MAX3421E chip which allows the Arduino to act as a USB host into which you can plug in USB client devices. Plugin a keyboard, restart the Arduino, inspect the example’s output via the Serial Monitor Detailed Explanation Open an example sketch, compile and upload the sketch.ĥ.

Add the library to the Arduino IDE, then restart the IDE.Ĥ. Plug in the shield to the Arduino Mega 2560ģ. This article explains how to run one of the example applications on the SainSmart USB Host shield on a Arduino Mega.Īnother good article is The steps to get an example running areġ.
