I completed it to the point where it had scan, stop scanning, connect and disconnect buttons and a listbox I suppose to show the list of available BT devices.
The write-up got me through the layout of the app. With the help of a video I learned how to enter the code puzzle pieces.
The write-up said to use the bluetooth-LE module which is what I did.
I got to the place where it said to check to see if it works using the AI2 helper app which I tried to do.
It says it is scanning when I press the scan button and stops scanning when I press the stop scanning button. However, I never see anything in the listbox. I assume there should be a list.
The device I want to connect to and use is around and works. It has already been paired with the phone and there are usually a few other BT devices around when I do a scan with some other device.
So I don't know if the bluetooth relay I want to control is an LE device or not. I also don't know if the bluetooth LE module works with a non LE adapter if it encounters one in a non LE way. I also wonder whethere there is an app that would not only scan for BT devices nearby, but also list whether they work with LE. I have't found any so far.
I know there is a plain bluetooth module as well. I assume I would just import it and then change any of the LE blocks to the same non LE blocks in the code.
The color coded puzzle pieces and real time debugger makes it look like it is pretty hard to enter the code wrong, but this doesn't appear to be working. Hence, my questions.
I'd paste the whole code, such as it is, but don't see how to copy all of it at once.
I saved the old project, downloaded and this new module and then deleted the old module and imported the new one.
It behaves the same as before. There are no networks listed.
I saw that this module is for Android 12. As it turns out I recently updated to Android 13. So that is a possibility.
I was going to ask a question before I did this but wound up answering my own question. I was going to ask if I would have to re-enter the code from the LE module again. I found out that when I deleted the old module that all the sections from blocks that were from the module had also been removed. So I did recreate that.
Your project contains 2020 BLE versions. This version will not work with android 12, much less android 13. If you have updated the extension, please post the current aia version.
You have set the background color in the ListView to white. The ListView's text color is also white. So even when the device list appears, you won't see it.
Try it: BT_Door_Opener.aia (194.8 KB)
Yes, I see this one the text shows and it finds something. I'm was in the basement and I did select connect and got a message that it wasn't valid connection, but I have no idea what it was and I'm sure it wasn't what I want to connect to.
I did change the text color for the list to black but I didn't see anything.
Maybe you made some other change?
I'll experiment a little but I remember when I was putting the label above where the list was I ran into the same thing where it was white text on a white background or something like that. Maybe while playing around a strayed into the list area, however that label I was able to get to be black text on a white background. It is odd that the default setting would be of same color text on same color background though.
I'll have to look more closely at this version I see the BT module is LE1. I don't recall a 1 in either of the other two, but am not sure.
I notice in the helper app there is an option to check to connect via legacy method. Just curios what this is.
Something came up last night and I never got a chance to try to see if the bluetooth relay I'm interested in was detectable. I did get a chance this morning.
The phone can detect it but the scan using the app doesn't find it, but does detect another nearby one.
It is an older BT relay. I'm thinking it might be easier to simply get another one that is compatible with app inventor BLE.
I can find modules for use with a relay on an Ardiuno and such and some that are just pre-made BTLE relays, however I see comments that some don't work with AI2 BLE
Is there anything that is reliable and just works?
I got it several years ago. This is the current listing on it, I don't know if the specs are the same https://eletechsup.taobao.com/
I thought maybe it might be easiest to get something newer designed for BTLE. This sounds like it is, in the comments someone suggested using MIT app inventor with it, but didn't mention BTLE.
You would have to open this white box and show what bt module is installed inside. Maybe it's not bluetooth LE but classic? You may be able to connect to this transmitter using the built-in BluetoothClient component.
I will ask if you have paired this module with your phone? To be discoverable in the app, it should not be paired.
Yes, it was paired. I unpaired it and went outside. It found a number of BT devices. I didn't recognize any as being that device. I only remember by a part of the long string.
I also noticed that the scan listbox had many lines and I could scroll them . I thought it would expand.
I also noticed that the new DSD device was on the list and I could connect. I can live with that.
I don't have a pushbutton setup yet to send the command or know what the correct command for this device is. I did come across so things on doing this sort if thing while I was looking for things about detecting the device though and saved them.
I'll also see the full string the other device displays and write it down as well. That involves going outside and its raining right now.
I got a chance to unpair the old BT relay and scan it with the phone and another app. I wrote down the full MAC address or whatever it was that was listed. Then I tried scanning with the app inventor app. I didn't find that address on the list, so I guess it can't see it.
I did try again the the DSD BLE relay board again and could both see it and connect with the app inventor app. I also connected with a terminal program and had found the on off hex commands for it and sent them with a terminal app. I can hear the relay clicking.
So I suppose with two buttons I can get it working, however I am trying to replace a normally open pushbuton switch. I haven't found a hex code for a momentary closure. Maybe I can send a hex string with the close command & a short pause & an open command in lieu of a specific code.
for the record the hex codes I have are:
Channel 1 ON A00101A2
Channel 1 OFF A00100A1
Channel 2 ON A00201A3
Channel 2 OFF A00200A2