Code:
#include "USBHost_t36.h"
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
USBHub hub3(myusb);
USBSerial userial(myusb);
const int ledPin = 13;
void setup()
{
while (!Serial) ; // wait for Arduino Serial Monitor
Serial.println("USB Host Testing");
myusb.begin();
Serial.println("Usb Host started");
//This never happends
userial.begin(416000);
Serial.println("Usb Seriel started");
pinMode(ledPin, OUTPUT);
byte init_1[] = {0x79, 0xf0, 0x15, 0x06, 0x00, 0x09, 0xd8, 0x25, 0x46, 0x8e};
byte init_2[] = {0x79, 0xf0, 0x19, 0x05, 0xfe, 0x38, 0xfb, 0x7e, 0x40};
byte init_3[] = {0x79, 0xf0, 0x15, 0x06, 0x00, 0x09, 0xd8, 0x25, 0x46, 0x8e};
byte init_4[] = {0x79, 0xf0, 0x1a, 0x05, 0x01, 0xde, 0x03, 0x46, 0x83};
userial.write(init_1,10);
userial.write(init_2,9);
userial.write(init_3,10);
userial.write(init_4,9);
Serial.println("Started.");
digitalWrite(ledPin, HIGH);
delay(3000);
digitalWrite(ledPin, LOW);
}
void loop()
{
int incomingByte;
myusb.Task();
if (userial.available() > 0) {
incomingByte = userial.read();
Serial.print("USB received: ");
Serial.println(incomingByte, DEC);
}
}
Best Regards