请帮帮我,我只能搜到ESP32的蓝牙,但是无法与其连接,错误代码os code4;ESP32上的代码使用micro python写的,经过nrf connect等蓝牙调试器的测试都能正常连接与通信,但始终无法与生成的app连接上;论坛里诸位大神的代码我也都失败了。
Please help me, I can only search for the ESP32's Bluetooth, but I cannot connect to it, with error code os code 4. The code on the ESP32 is written in MicroPython, and after testing with Bluetooth debuggers like nRF Connect, it can normally connect and communicate. However, I am always unable to connect with the generated app; I have also tried the code from experts on forums, but all attempts have failed
An excellent phone, shouldn't be an issue. I'm going to take a look at the files you have uploaded. Android 14 has some strict rules for compiled Apps which the projects on the forum don't necessarily cover.
There should not be a need to manipulate the target address picked from a List - the BLE ConnectWithAddress Block does that for you.
Stop Scanning After Picking (no later than that)
You have Registered For Strings - that is to receive stream of data, but you are only sending data with your Blocks.
On intialising Screen1, you must request permissions for Android 14. How you go about doing that depends on whether the App is only for your Use on your Android 14 phone or if it will be used on other phones and other Android versions. Let us know so we can guide you more.
Drag a Location Sensor into the Designer. Your App doesn't need to have a use for it, it's just to satisfy Google's requirement for Bluetooth use.
The values expected are not the values sent from the App (BLE_MSG). When you sort that out, do not use "!" in the message. You should be able to use a single character for each (A = start_power(), B = add_power etc).
I'm not that familiar with MicroPython (We use Arduino C for ESP32) but neither the reader nor the sender UUIDs have a type definition as far as I can tell.
Regarding the '!', it's because I found an app to control a car via Bluetooth. After testing, the information that its control buttons pass to the ESP32 is just these. I have temporarily completed my DIY for the lights using it, but I still hope to have an app that can more intuitively control the lights
Hello, first of all, thank you for your help. I have successfully completed the connection with the ESP32. However, during the process of transmitting information, I found that the bytes sent from the app come with a square box, and I am unable to write this square box into MicroPython.
Yes, the 'box' is a line feed character? Read the 1st character of the string received into BLE_MSG, which should be BLE_MSG[0]. I understand that requires Python 3.x