Sample Code for USB Host with Teensy 3.2?

Status
Not open for further replies.

MajorTom

Member
I'm using a Teensy 3.2 with a 4,7uF capacitor and I want to use the Teensy USB Host mode... to connect a Android 4.2 device without USB Host port (only USB).

I want to communicate over a serial connection (ADB) ... but it doesn't work.

Can someone give me an example of code?


On the Android side I've made a Server on port 4567 ... and here is my Arduino Code:

Code:
  // Initialise the ADB subsystem.  
  ADB::init();

  delay(1000);
  
  // Open an ADB stream to the phone's shell. Auto-reconnect
  connection = ADB::addConnection("tcp:4567", true, adbEventHandler);  


void loop() {
  
  
  if ((millis() - lastTime) > 1000)
  {
    uint16_t data = 22;
    connection->write(2, (uint8_t*)&data);
    lastTime = millis();
  }

  // Poll the ADB subsystem.
  ADB::poll();

}
 
Status
Not open for further replies.
Back
Top