MATLAB Answers

MATLAB can't find arduino (MAC)

71 views (last 30 days)
Mark
Mark on 9 Feb 2015
Commented: Dhifaoui Bilel on 29 Jul 2020
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 Comments
Dhifaoui Bilel
Dhifaoui Bilel on 29 Jul 2020
close the serial of arduino IDE and then re-run the matlab code .

Sign in to comment.

Answers (3)

Martin Foltin
Martin Foltin on 25 Dec 2015
Edited: Walter Roberson on 25 Dec 2015
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 on 25 Dec 2015
Edited: Walter Roberson on 26 Dec 2015
>> 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 on 29 Sep 2016
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