How to do Android and Arduino bidirectional communication?
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);
}