Accessing Arduino Uno through matlab
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
Rouzbeh Amini
2014-11-20
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
2016-5-13
i am facing same problem in widows 10 matlab 2014 Version .what can i do to fix it?
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 MATLAB Support Package for Arduino Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!