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ģ.
You can now type commands to the dongle.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ġ. You should see the word ‘Start’ and then see the dongle running two commands: setting response data and starting the advertising.Or inside the Arduino IDE open up Arduino Monitor and in the bottom right corner select ‘Carriage Return’ and ‘115200 baud’.Open up the ‘Arduino Uno Viritual COM Port’ with a serial terminal emulation program like TeraTerm, Putty or CoolTerm.Serial port Setup:.In Arduino IDE click the upload button to upload the project to your Arduino.Search for USB Host Shield Library 2.0 and click ‘Install’.In Arduino IDE choose Sketch>Include Library>Manage Library.(For information on installing libraries, see: ) 4.2 Downloading the USB Host Shield Library 2.0Įither download the Library from Here ( ) and place the folder into your libraries folder inside your Arduino folder.
How to setup project 4.1 Downloading the project from GitHubĮither clone the project, or download it as a zip file and unzip it, into your Arduino folder. You must also apply a jumper from pin D7 to RESET.Ĥ.With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack.A BleuIO dongle with firmware version 2.1.0 or later ( ).Using the example project 3.1 What you will need When found, we just print out “>” or “>” to the terminal. In this example, we are explicitly looking for BLE connection or disconnect events. We also store the latest data from the dongle into the dongle_input buffer and run it through a simple “parser” to showcase an easy way of how you can react to events and have the Arduino do something. If( rcvd ) //if( Usb.getUsbTaskState() = USB_STATE_RUNNING. Memset(dongle_input, 0, sizeof(dongle_input)) Rcode = Acm.SndData(strlen((char *)START_CMDS), (uint8_t *)START_CMDS)
If the buffers have received any data, we print it out to the serial terminal connected to the Virtual COM Port. The largest possible max.packet size for the function Acm.RcvData() is 64 bytes, so to accommodate the amount of data we will receive, we are using three buffers to receive the data from the BleuIO Dongle. This project based on the ‘acm_terminal’ example in the Host USB Shield Library 2.0 3 with SparkFun’s USB Host Shield (DEV-09947) for this example. It will then act as a terminal, taking input and sending data to the Arduino Virtual Com Port. When a BleuIO Dongle is connected to the USB port, the BleuIO Dongle will start advertising. The project is a simple example showcasing a quick way to setup an Arduino with a USB Host Shield as a USB CDC Host capable of communicating with the BleuIO Dongle.