This example shows how to connect the MATLAB® software running on a Mac computer to an EV3 brick over a Bluetooth® connection.
Required hardware: A compatible USB Bluetooth dongle or a host computer with built-in Bluetooth.
For an example that uses Windows®, see Connect a Host Computer Running Windows to an EV3 Brick Using Bluetooth.
On the Mac computer, edit the Bluetooth settings. Enable Bluetooth and make the computer visible to other devices.
In the EV3 interface, under settings, select Bluetooth.
Enable Bluetooth and Visibility. Then, select the large check mark.
Confirm that Bluetooth is enabled.
On the Mac computer, add the EV3 brick to the list of Bluetooth devices.
On the EV3 interface, when you see Connect?, select the check mark.
On the EV3 interface, read the PASSKEY value
1234) and select the check mark.
Ignore the underscore character at the end of the passkey value.
On the Mac computer, enter the passkey value as the Bluetooth pairing key.
Get the device name of the serial port connection to the EV3 brick. Open Terminal in Mac OS and enter:
In the MATLAB Command Window, use the
legoev3 function to connect to the
EV3. Specify the connection type, Bluetooth, and the device name of the serial port connection to the EV3 brick.
myev3 = legoev3('Bluetooth','/dev/tty.EV3-SerialPort');