How to connect a BBC micro-bit to MatLab 2023b

22 views (last 30 days)
Beibhinn
Beibhinn on 9 Apr 2024 at 22:30
Answered: Raj on 17 Apr 2024 at 5:11
I am a beginner Matlab user and am trying to connect a BBC microbit to my MatLab script on a Mac. I have identified the name of the port for the microbit and have added this to my script. I run into a probelm when running the script as the error message produced says that it is unable to connect to the serial port device. It suggested that the port may be in use. I believe this to be the issue as this port is not listed when I run the serialportlist("available") function. Could someone advise on how I can make this port available for use or what else may be causing this issue. Thank you!
Error message as follows:
"Error using serialport
Unable to connect to the serialport device at port '/dev/tty.usbmodem1102'. Verify that a device is connected to the port, the port is not in use,
and all serialport input arguments and parameter values are supported by the device.
See related documentation for troubleshooting steps."

Answers (1)

Raj
Raj on 17 Apr 2024 at 5:11
Hello @Beibhinn
I understand you are facing error while connecting BBC microbit to MATLAB. While connecting a serial device it is recommended to connect to a serial port which is available and free to use. If an attempt is made to connect a serial device to a port already in use by other application, MATLAB will throw an error.
MATLAB function 'serialportlist' returns a list of all serial ports on a system. This function can be used to get list of all available ports and you can connect the microbit to the same available port.
For better understanding refer to the documentation links below-
You can also refer the following moving ahead with your work with BBC microbit and MATLAB-
I hope this resolves your query and you are able to proceed further!

Products


Release

R2023b

Community Treasure Hunt

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

Start Hunting!