Hi
I have used the extension BluetoothLE1. How do i send a value of '0' or '1' to my Arduino board via bluetooth? The usual route seems to be ".Sendtext". That option is not available when using the BluetoothLE1 extension. I hope i am making sense. I am not a very techie guy...
Thanks
D
!
In extension is this block:
1 Like
I just tried doing it... here's where i get stuck. Where can i get the "get globalserviceuuid" blocks? I found some at the variables menu. But the dropdown does not give me an option to pick "global serviceuuid".
Thanks a ton for your help!
UUID values are hardware dependent, so I have not provided them. Here are valid values for HM10.
For other modules, look for the values in google or read them from the module using some ble scanner.
1 Like
This has helped. Like you mentioned, i copied the uuid values from a BLE scanner app. I am not getting any errors anymore... everything is fitting.
However it is still not delivering the value (0 or 1) to the device. I am not able to control the device. Do you think its because of the "make a list" block? The "make a list" block, i have used has two notches (apologies for not using the right words). The block you have sent me has only one notch. Could that be the problem? Because in my case, one notch stays empty.
Thanks Patryk
Before you send the data, you need to connect to the BT module from the app, did you do it?
I have connected the BT device (An arduino Nano 33 ) to the App. I found the device when i scanned. I also have a label for the device name once found after scanning. So i presume thr BT device is connected.
The blocks look good. What version of the ble extension are you using?
I am using an extension called BluetoothLE1
Extensions have their versions:
I just downloaded this version of BluetoothLE... It however hasn't made a difference. I still am not able to deliver the value to the BLE device.
Another thing I think to check is the arduino code. I don't have much experience with arduino with a built-in ble module, mostly I used external modules. Show the code arduino.
It is the standard arduino sketch for BLE peripheral called 'LED'. However i have renamed it as LEDTEST.
HI Patryk... I was just looking at some other example where they have used "Writebytes"... The have also used an "If Else" in addition to the "write bytes"
I tried it and it worked!!!!
Works like a charm... I can't thank you enough Patryk!!!
But you used with response blocks. I think using response blocks for strings would also work.
I had tried response block previously... with string, with bytes. didn't seem to work. The "if then" block is what i thought made a difference... but again i didnt know about app inventor until yesterday... so i wouldn't know. I can test out response block with string and tell you if it makes a difference.
The if.isDeviceConnected block only checks if the bt device is connected to the app. Prevents an error from popping up when you want to send data with a button when the BT device is not connected. For the sake of sending data, it makes no difference.