Android Mode - Serial Communication - Andruino

edited March 2018 in Android Mode

Hi, nice to meet you.

I want (Arduino) ------- (Smartphone) Serial connection.

Processing 3.2.1. Android Mode 3.0.1

> API 6.0

======================================================================

import io.inventit.processing.android.serial.*; //ANDROID

Serial myPort;      
String inString=""; 

void setup() {

  myPort = new Serial(this, Serial.list(this)[0], 38400); 
  myPort.bufferUntil(10);
}

//===========INCOMING DATA FROM THERMOSTAT=============
void serialEvent(Serial myPort) { 


  try {
    inString = myPort.readString();

  }
  catch(RuntimeException e) {

  }


}

====================================================================== **Error msg : **

Processing - Android USB Serial Error.

Q

Answers

  • What am I doing wrong?

    Let me know what went wrong. Help.

  • I've never used direct otg usb connection, because my kitkat device didn't support it. (only 5.1 and above.) , I only use bluetooth. But ofcourse you are using the same boudrate 38400 in your ino sketch? How do you know that the port really is the the first [0]?

  • @noel

    I think [0] is right. Because there is no other device.

    I do not know why the OTG USB library does not work.

  • What do you mean by > API 6.0? You are aware that this lib only support Api level 21 and above? I don't now how this works in Android, but in Windows it can assign any number far higher then number of devices like 45 or whatever. Isn't there within the lib a function that list the ports in the console?

  • edited March 2018

    @noel

    1) Api level 21 UP // right

    2) In the print statement, there is no serial list at all.

Sign In or Register to comment.