Bluetooth is a wireless communication protocol for exchanging data over short distances using short wavelength radio transmissions. Common devices with Bluetooth capabilities include laptops, phones, and wireless sensors.
Use the Bluetooth interface in MATLAB® to transmit and receive ASCII and binary data. This interface uses the Bluetooth Serial Port Profile (SPP). You can identify any Bluetooth SPP device and establish a two-way connection with that device from MATLAB.
To communicate with a Bluetooth device, your computer needs to have a built-in or external Bluetooth adapter. For more information, see Configure Bluetooth Communication Settings.
To simulate, analyze, and test Bluetooth communications systems, see Bluetooth Toolbox.
Connect and Configure
|Scan nearby Bluetooth Classic devices (Since R2020b)|
|Connect to Bluetooth Classic device (Since R2020b)|
|Set terminator for ASCII string communication with Bluetooth device (Since R2020b)|
|Set callback function and trigger condition for communication with Bluetooth device (Since R2020b)|
Read and Write
- Bluetooth Communication Overview
Learn about the basic concepts of Bluetooth communication.
- Configure Bluetooth Communication Settings
Establish a connection between MATLAB and your Bluetooth device.
- Transmit Data Using Bluetooth Communication
Write and read both text and binary data with a Bluetooth device.
- Use Callbacks for Bluetooth Communication
Enhance instrument communication by executing a callback function when a specified event occurs on the device.
- Transition Your Code to bluetooth Interface
Connect to Bluetooth devices using
Troubleshoot the Bluetooth interface.
Troubleshoot connecting to a Bluetooth device.
Troubleshoot when you receive no data and you get the warning message: Bluetooth unable to read any data.
Troubleshoot when you receive some data and you get the warning message: Bluetooth unable to read all requested data.