 }
 
 void loop() {
-  Serial.println("Looping");
-  readingFromADK();
+  Serial.print(".");
+  Usb.Task();
+  // Starting listening when ADK is available
+  if (adk.isReady()) {
+    readFromADK();
+    sendingToADK();
+  }
+
 }
 
 void stopEngine() {

USBHost Usb;
ADK adk(&Usb, manufacturer, model, accessoryName, versionNumber, url, serialNumber);
// End ADK configuration

int randomint;
int last_send = 0;
uint8_t buffer[BUFFSIZE];
char bufNew[BUFFSIZE];
char charBuf[2000];
uint32_t bytesRead = 0;

DualMC33926MotorShield tank;

void setup() {

    for (int i = 0; i < s.length(); i++) {
      bufNew[i] = s.charAt(i);
    }
    memset(outStringBuffer, 0, BUFFSIZE);
    sprintf(outStringBuffer, "%d,%d,%d", randomint, randomint - 1000, randomint + 1000);    
    memcpy(outBuffer, outStringBuffer, BUFFSIZE);
    adk.write(strlen(outStringBuffer), (uint8_t*)outBuffer);
      if (DEBUG_MODE) {
    Serial.print("Sending | ");
    Serial.print(outStringBuffer);
    Serial.print(" | ");
    Serial.print(strlen(outStringBuffer));
    Serial.println(" bytes outgoing");
  }
  }
  

  //writeToAdk(charBuf);
  delay(DELAY);
}


