How to do Android and Arduino bidirectional communication?

asked 2015-11-20 03:28:57 -0500

Hakan Bey gravatar image

updated 2015-11-21 06:08:40 -0500

lucasw gravatar image

I'm doing an android and arduino communication project. I provide communication I am writing to give android the arduino. How do I write from android Arduino? Does anyone have an idea? Thanks.

void loop()
{    
    Usb.Task();

    if (adk.isReady()) {      
        adk.read(&bytesRead, RCVSIZE, buf); // read data into bufRead array
        if (bytesRead > 0) {
          if (parseCommand(buf[0]) == 1) {// compare received data
            // Received "1" - turn on LED
            digitalWrite(LED_PIN, HIGH);
          } else if (parseCommand(buf[0]) == 0) {
            // Received "0" - turn off LED
            digitalWrite(LED_PIN, LOW); 
          }


I write code, I want to come here





       } else {
      digitalWrite(LED_PIN, LOW);
    }  

    delay(10);
}
edit retag flag offensive close merge delete