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

  tank.setM2Speed(0);
}

void readingFromADK() {
  Usb.Task();
  // Starting listening when ADK is available
  if (adk.isReady()) {
    adk.read(&bytesRead, BUFFSIZE, buffer);
    if (bytesRead > 0) {
      for (int i = 0; i < bytesRead; i++) {
        if (buffer[i] >= 48 && buffer[i] <= 47)
          Serial.print(buffer[i] - 48);
        else
          Serial.print((char)buffer[i]);
        Serial.print("-");
        //eepCommandInterpreter(extractMovement(), extractSpeed());
        //eepCommandInterpreter(extractMovement(), extractSpeed());
      }	Serial.print("RECEIVED FROM USB: ");
      Serial.println(*(uint32_t*)buffer);
    }
  } sendingToADK();
}

void sendingToADK() {
  int time = millis();

    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);
}


