Accessing Arduino Uno through matlab
Afficher commentaires plus anciens
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 commentaires
Geoff Hayes
le 25 Oct 2014
Bandar - you may want to provide some more details. Perhaps include your version of MATLAB and OS.
Rouzbeh Amini
le 20 Nov 2014
I have the same problem. After running my MATLAB script, I receive the following error:
Failed to open serial port /dev/tty.usbmodemfffffffffd121 to communicate with Arduino board Uno. Make sure there is no other MATLAB arduino object for this board. For troubleshooting, see Arduino Hardware Troubleshooting.
I am using MATLAB R2014a, running on a Macintosh laptop (Macbook Pro). I tired the following two scripts and got the same error both times: Script 1:
clear all
a = arduino();
Script 2
clear all
a = arduino('/dev/tty.usbmodemfffffffffd121','uno');
FYI, it gives me the same exact error when the Arduino is not plugged in.
Thanks for your help in advance,
-RA
Rouzbeh Amini
le 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
le 13 Mai 2016
i am facing same problem in widows 10 matlab 2014 Version .what can i do to fix it?
Réponses (0)
Catégories
En savoir plus sur MATLAB Support Package for Arduino Hardware dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!