Newbie question on what can I do in Android

Discussions specifically related to the Android and iOS editions of BBCSDL
Post Reply
stevewidg
Posts: 2
Joined: Sat 24 Nov 2018, 00:02

Newbie question on what can I do in Android

Post by stevewidg » Sat 24 Nov 2018, 00:53

Hello,
Ive been looking around for some time for a nice simple cross platform compiler to display data from an Arduino on various platforms. Connection would be via Bluetooth (or possibly WiFi) As this is not (I dont think) a core function, how can I connect my Arduino? An example would be great. I realise that this is still in Beta, and perhaps it cant currently be done, I guess that things like sensors, camera are platform specific (from posting on Vibrate) is there a plan to have a method of adding these devices.
Its great to see an old favourite still has life in it ( its still a LOT younger than me though!!!)

Thanks
Steve

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: Newbie question on what can I do in Android

Post by guest » Sat 24 Nov 2018, 01:29

stevewidg wrote:
Sat 24 Nov 2018, 00:53
how can I connect my Arduino? An example would be great.
The easy way is to set up a WiFi socket connection via your router. There are a number of example programs supplied with BBCSDL that make connections via sockets, both to the wider internet (e.g. 'ceefax.bbc' and 'banner.bbc') and to other machines via a LAN ('client.bbc', 'server.bbc' and 'lanchat.bbc'). I don't know anything about the Arduino but I would expect that it can just as easily make socket connections so establishing a link that way ought to be straightforward. Documentation for BBC BASIC's 'socklib' library can be found here.
I guess that things like sensors, camera are platform specific (from posting on Vibrate) is there a plan to have a method of adding these devices.
As you probably know, the extent to which I can contribute to such endeavours is increasingly limited. But I would be delighted for users to contribute code, which I could then distribute with BBCSDL in the form of a library or libraries.

One issue specific to Android and iOS is that apps must be given permission to access devices like the camera and some other peripherals; currently BBCSDL does not request that permission: you can access the accelerometer (and the internet) but that's all. If somebody wanted to experiment with accessing the camera one solution is to use the BBC2APK utility (available from the web site) to build a custom app that requests that permission.

stevewidg
Posts: 2
Joined: Sat 24 Nov 2018, 00:02

Re: Newbie question on what can I do in Android

Post by stevewidg » Sat 24 Nov 2018, 11:45

Wow,
amazingly quick response, thank you, looks like someone was up later than me!!. I really would prefer BT. The arduno is only an 8 bit chip, and although it can be done I dont think its as easy as BT to Android which effectively becomes a serial port. I can do it in B4A, which is good, but really requires more knowledge of Java/VB than I wanted, or needed. BT is also available in RFO basic, but that has no cross compiler capability. Most Android - Arduino wifi connections seem to go through a cloud server, which means you have to have internet access, or by connecting device directly to Android wifi which means you cant connect to Internet. For my applications a serial port by USB would be great, but then thanks to the stupidity of using the USB to charge as well as data transfer many tablets/phones can only do one or the other.
I wil explore socklib further.
Thanks
Steve

guest
Posts: 227
Joined: Mon 02 Apr 2018, 09:12

Re: Newbie question on what can I do in Android

Post by guest » Sat 24 Nov 2018, 14:19

stevewidg wrote:
Sat 24 Nov 2018, 11:45
I really would prefer BT.
By all means use Bluetooth, but it will be more work. I suggested a socket connection because that is supported 'out of the box' in BBC BASIC and there is a supplied library 'socklib.bbc' to make it easy. Bluetooth is not currently supported by a library, but if you would like to be the guinea-pig and help develop (or at least test) the necessary code I would be very happy for you to do so! For a start it will be necessary to grant BBC BASIC this permission:

Code: Select all

<uses-permission android:name="android.permission.BLUETOOTH" />
As I mentioned, one way of doing that is via the BBC2APK Android Application generator, but if it proves possible to support Bluetooth via a BBC BASIC library I would of course want to make it a standard permission requested by BBCSDL.
Arduino wifi connections seem to go through a cloud server, which means you have to have internet access, or by connecting device directly to Android wifi which means you cant connect to Internet.
It's not obvious to me why that should be the case, but as I said I'm not an Arduino expert. If both those options are available I would have expected that a connection via your main WiFi router should also work, it's 'just' another socket connection after all.

Post Reply