Page 1 of 1

Android wired connection

Posted: Wed Aug 21, 2019 5:03 pm
by SparkOut
Hi, I am wondering if there is any way to make a connection from an Android device using a USB OTG (on the go) cable to connect to any kind of device by physical cable, that can be sent on demand?
I am not really bothered whether the connection contains meaningful data or not, but that would be an advantage, I suppose. I really just need a signal that can be generated on the Android tablet that can trigger a device to receive a signal. I am open to what sort of device is needed for the receiver - it is a little complicated to explain but in essence can be thought of as a door keypad. Touch the right code on the Android and the USB OTG cable can deliver a signal that can be received and interpreted to open a door lock. This can be as simple as sending a voltage high on the power lines wired directly to a dumb relay, or as complicated as sending the signal with a data payload to a computer (or Arduino, or Raspbi Pi or whatever) for analysis/logging/processing/deciding whether to open the door or not. I just need something generated on the Android tablet (Nexus 9) to be detectable by whatever receiver I need to detect it. Is there any way I can achieve this?

Re: Android wired connection

Posted: Fri Aug 23, 2019 9:07 am
by AndyP

Re: Android wired connection

Posted: Sat Aug 24, 2019 5:11 am
by SparkOut
Thanks Andy, that took me down an interesting rabbit hole but isn't going to help me, I don't think. Also, it appears that Phidget API 22 has dropped support for LiveCode.
I think I can get a usb library for Android from github and will be testing that this weekend. Even if successful though, the trouble I would have is getting the library to integrate or communicate with LiveCode. With sandboxing,how do I get LC to tell the other app to send data to the usb line?
Might it even be possible to use LCB to wrap an Android serial API?

Re: Android wired connection

Posted: Thu Aug 29, 2019 11:58 pm
by SparkOut
Well I have got a successful OTG connection to the Arduino using the library here https://github.com/felHR85/UsbSerial/ and following the information here https://www.allaboutcircuits.com/projec ... h-android/
All is good with the setup in Android Studio, I can use the provided app to send to and echo data from the Arduino. 

Now the only problem is how to get LiveCode to tell the app to send the required data. (Or bypass the other app, which is what I really want to do.)

Can I use the compiled jar file in a LCB wrapper to call the necessary features in the jar file?
The following tutorial also goes on to detail Bluetooth connection to the Arduino. This might be even better for me, as it will keep the USB port on the tablet free for charging.

Same scenario goes though, how to get the LC app to let the library know to send the signal to the Arduino?