MATLAB can't find arduino (MAC)

29 次查看(过去 30 天)
Mark
Mark 2015-2-9
I've been trying to connect the arduino to the MATLAB software.
>> a = arduino('/dev/tty.usbmodemfa131');
However, MATLAB constantly responds:
No Arduino hardware is found on port /dev/tty.usbmodemfa131. If using an official Arduino board, make sure it is plugged in. Otherwise, please specify both port and board type. For more information, see the arduino function reference page.
I am sure that I connected the USB to the right port. The Arduino IDE works perfectly on the same port.
To be more elaborate. I use a real Arduino UNO hardware, a macbook, MATLAB 2014a.
  2 个评论
Giacomo Pedretti
Giacomo Pedretti 2015-9-29
Same problem with Arduino Due, MacOS X, MATLAB 2015A And the funny thing is that a couple of months ago it was working perfectly. I just went back to the project and there's no way MATLAB can find arduino
Dhifaoui Bilel
Dhifaoui Bilel 2020-7-29
close the serial of arduino IDE and then re-run the matlab code .

请先登录,再进行评论。

回答(3 个)

Martin Foltin
Martin Foltin 2015-12-25
编辑:Walter Roberson 2015-12-25
Same problem. MATLAB R2015b + MacBookAIR + ARDUINO UNO. The Arduino IDE works without problems.
>> x=instrhwinfo('serial')
x =
HardwareInfo with properties:
AvailableSerialPorts: {4x1 cell}
JarFileVersion: 'Version 3.8'
ObjectConstructorName: {4x1 cell}
SerialPorts: {4x1 cell}
Access to your hardware may be provided by a support package. Go to the Support Package Installer to learn more.
>> x.SerialPorts
ans =
'/dev/tty.Bluetooth-Incoming-Port'
'/dev/cu.Bluetooth-Incoming-Port'
'/dev/tty.usbmodemFD121'
'/dev/cu.usbmodemFD121'
>> a=arduino('/dev/cu.usbmodemFD121')
Cannot find Arduino hardware on port
/dev/cu.usbmodemFD121. Make sure Arduino hardware
is properly plugged in. Otherwise, please specify
both port and board type. For more information,
see arduino function reference page.
>>

Martin Foltin
Martin Foltin 2015-12-25
编辑:Walter Roberson 2015-12-26
>> a=arduino('/dev/cu.usbmodemFD121','Uno')
a =
arduino with properties:
Port: '/dev/cu.usbmodemFD121'
Board: 'Uno'
AvailablePins: {'D2-D13', 'A0-A5'}
Libraries: {'I2C', 'SPI', 'Servo'}
Important is 'UNO' parameter !!!

Luis
Luis 2016-9-29
Please, type the command as following:
>> a = arduino('/dev/cu.usbmodemfd121','Due')
Updating server code on Arduino Due (/dev/cu.usbmodemfd121). Please wait.
a =
arduino with properties:
Port: '/dev/cu.usbmodemfd121'
Board: 'Due'
AvailableAnalogPins: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
AvailableDigitalPins: [2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53]
Libraries: {'I2C', 'SPI', 'Servo'}
>>
% Its very important to notice that '/dev/cu.usbmodemfd121' is different from '/dev/cu.usbmodemFD121'. If you do so, you will get the error message you are receiving. So, pay attention, please!!!!

Community Treasure Hunt

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

Start Hunting!

Translated by