Serial communication between android and microcontroller


#1

I am using Processing 3.5.2 on windows 7. Making an application for android which deals with serial communication. (wired and not Bluetooth).

Now, If I use the program in java mode with corresponding default serial library, it works just fine. But problem occurred when I shifted to android mode. I used the library from this site: https://github.com/inventit/processing-android-serial
Even after following the instructions very carefully. It failed.
Now, the issue was that the connection between android and the computer (for launching the application on the device) and the connection between android and the micro controller (for data transfer) uses a common port i.e. the mini-usb port. So, the program was written in such a way that the serial connection will only be done after a click on the screen.
With this Processing tells me “built successful” and it launches the application on the device when i click ‘run on device’.
After this when I close the app and reopen it , connect the micro controller connection and click the button to connect serial, it gives me this error:

java.lang.IllegalArgumentException: This library works only on Android.
at com.yourinventit.processing.android.serial.SerialCommunicatorFacory.create(SerialCommunicatorFacory.java:67)
at com.yourinventit.processing.android.serial.Serial.(Serial.java:41)
at com.yourinventit.processing.android.serial.Serial.(Serial.java:50)
at com.yourinventit.processing.android.serial.Serial.list(Serial.java:263)
at processing.test.android_mode_network_analyzer.Android_mode_Network_analyzer.mousePressed(Android_mode_Network_analyzer.java:256)
at processing.core.PApplet.mousePressed(PApplet.java:2349)
at processing.core.PApplet.handleMouseEvent(PApplet.java:2132)
at processing.core.PApplet.dequeueEvents(PApplet.java:2051)
at processing.core.PApplet.handleDraw(PApplet.java:1865)
at processing.core.PSurfaceNone.callDraw(PSurfaceNone.java:476)
at processing.core.PSurfaceNone$AnimationThread.run(PSurfaceNone.java:516)

Even after I do things as mentioned on that aforementioned site, it doesn’t work.

Any suggestions? I am suspecting the library because everything works fine in java mode.