Accessing Arduino Uno through matlab

2 views (last 30 days)
Bandar
Bandar on 24 Oct 2014
Commented: m kamrul hassan on 13 May 2016
Why do I get this when I try to connect my Arduino Uno to matlab using the code below:
a = arduino()
Failed to open serial port /dev/tty.usbmodemfffffffffa131 to communicate with Arduino board Uno. Make sure there is no other MATLAB arduino object for this board. For troubleshooting, see Arduino Hardware Troubleshooting.
  4 Comments
Rouzbeh Amini
Rouzbeh Amini on 20 Nov 2014
OK, I figured it out!
Here is what you should do:
1. Open a terminal and run
ls /dev/*
You should get the correct name of your usb port in the list. Mine was 'tty.usbmodemfd121'. Yours may end in another number.
2. Make sure that in your MATLAB script you create your object by specifying the correct port name. In my case the command line was:
a = arduino('/dev/tty.usbmodemfd121','uno');
3. You may receive the following error:
Arduino IDE at folder
'*/MATLAB/SupportPackages/R2014a/arduino-1.5.6-r2/Arduino.app/Contents/Resources/Java' has been corrupted. Open Support Package Installer to reinstall MATLAB Support Package for Arduino Hardware
click on the 'reinstall MATLAB Support Package' to reinstall the package.
4. After it is reinstalled, use the script again (to be safe, I clear everything first):
clear all
a = arduino('/dev/tty.usbmodemfd121','uno');
The first time that you run it, it may need to perform an update and give you the following message:
Updating server code on Arduino Uno (/dev/tty.usbmodemfd121). Please wait.
After that it has been running without any problem. Hope this works for you, too.
-RA
m kamrul  hassan
m kamrul hassan on 13 May 2016
i am facing same problem in widows 10 matlab 2014 Version .what can i do to fix it?

Sign in to comment.

Answers (0)

Categories

Find more on MATLAB Support Package for Arduino Hardware in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!