Communication between Arduinos using USB Host Shield I'm working on a project that needs to use USB to pass serial messages between Arduinos (I can't use I2C or SPI for a few reasons – I especially need USB's support for hot-swapping and address allocation). So far I have the USB Host Shield set up on one Arduino Uno, connected to the standard USB port on another. It appears to be working, as can be seen when I run the board_qc:



The 'slave' Arduino is just running the following code:

void loop() {
  Serial.println("Hello");
  delay(1000);
}


On the master, I create a USB object from the USB Host library (https://github.com/felis/USB_Host_Shield_2.0).

USB Usb;

void setup() {
    Serial.begin(115200);
    Usb.Init();
}

void loop() {
    if (Usb.getUsbTaskState() == USB_STATE_RUNNING)
    {
        Usb.ForEachUsbDevice(&amp;PrintAllData);
    }
} 

void PrintAllData(UsbDevice *pdev)
{
    UsbDeviceAddress adr;
    adr.devAddress = pdev-&gt;address.devAddress;
    Serial.println(adr.devAddress, HEX);

    uint8_t msg = 0;
    uint16_t len = 0;
    uint8_t rcode = Usb.inTransfer(adr.devAddress, pdev-&gt;epinfo-&gt;epAddr, &amp;len, msg);

    if (rcode &amp;&amp; rcode != hrNAK) {
     Serial.print(F("\r\nData rcv: "));
     Serial.print(rcode, HEX);
   } else if (len &gt; 0) {
     Serial.print(F("\r\nData Packet: "));
     Serial.print(msg[0]);
   }
}


I'm not getting any data through though. Does anyone have any suggestions? Or know of any helpful sample code?
Have you tried this lib's documentation? It looks like just doing init() and then checking the task state is not enough.

Looking at the source code makes me think you might want to add a call to the main task/state machine, e.g. add a call to Usb.Task(); to your loop, before your if statement.