New "bluetooth" function doesn't pair with device; old "Bluetooth" function does work.

2 vues (au cours des 30 derniers jours)
¡Hello comunity!
I'm trying to connect an ESP32 via Bluetooth serial.
I've tried both the old Bluetooth function from the "instrument control toolbox" and the new bluetooth function.
The old function works fine, but I recieve a warning that it will be removed in a further Matlab version; meanwhile, the new function throws an error.
Here is the code I'm using to pair with the ESP32:
list=bluetoothlist
%%Result:
%%"ESP32test" "7C9EBDF5434A" 1 "Ready to connect"
device1=Bluetooth("ESP32test",1)
%%Result:
%%Connects with no problem.
device2=bluetooth("ESP32test",1)
%%Result:
%%Unable to find paired device with specified name or address "ESP32test".
%%Run bluetoothlist to check device status and channel number.
I would like to know if I'm using the new function incorrectly, wouldn't like my code to stop working when Mathworks removes the old function in further versions..
¡Thank you!
  2 commentaires
Rafael Masot
Rafael Masot le 14 Avr 2022
I have the same problem. My bluetooth is built-in PC and recognize my device bluetooth without problems (ESP32). In Matlab I can see the device.
>> bluetoothlist
Run blelist to search for nearby Bluetooth Low Energy peripheral devices.
ans =
1×4 table
Name Address Channel Status
_________ ______________ _______ __________________
"ESP32BT" "2462ABF2FBDA" 1 "Ready to connect"
But when I try to connect, the message is the next:
>> bt=bluetooth("ESP32BT")
Unable to connect to device. Run bluetoothlist to check device status
and channel number.
See related documentation for troubleshooting steps.
Please, anybody can help us?
Aldo Vladimir Roman Diaz
Aldo Vladimir Roman Diaz le 21 Avr 2022
I resolved the issue for Bluetooth Classic. Maybe something simmilar will work for BLE.
The problem was with the sketch used in ESP32.
  1. Use SerialToSerialBT_SSP_pairing example sketch. SerialToSerialBT will not work.
  2. Pair ESP32 with your PC as with any BT device. Confirm connection in PC, via BT configuration pannel, and in ESP32, via Arduino Serial Monitor.
  3. Connect ESP32 to MATLAB as shown in documentation

Connectez-vous pour commenter.

Réponses (1)

Aldo Vladimir Roman Diaz
Aldo Vladimir Roman Diaz le 21 Avr 2022
I resolved the issue for Bluetooth Classic. Maybe something simmilar will work for BLE.
The problem was with the sketch used in ESP32.
  1. Use SerialToSerialBT_SSP_pairing example sketch. SerialToSerialBT will not work.
  2. Pair ESP32 with your PC as with any BT device. Confirm connection in PC, via BT configuration pannel, and in ESP32, via Arduino Serial Monitor.
  3. Connect ESP32 to MATLAB as shown in documentation

Tags

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by