Error trying to turn on arduino
13 views (last 30 days)
Show older comments
I'm attempting to get a program running throw matlab to the arduino, I believe I have the com port set up and working correctly. The error occurs in the loop while trying to blink the led on the 1st writeDigitalPin line. I will include my input output lines hopefully it will help.
Input
instrfind
a=arduino('COM4');
for i = 1:10
writeDigitalPin(a, 11, 0);
pause(0.5);
writeDigitalPin(a, 11, 1);
pause(0.5);
end
OUTPUT
Serial Port Object : Serial-COM4
Communication Settings
Port: COM4
BaudRate: 9600
Terminator: 'LF'
Communication State
Status: open
RecordStatus: off
Read/Write State
TransferStatus: idle
BytesAvailable: 0
ValuesReceived: 3
ValuesSent: 1
Undefined function 'arduino' for input arguments of type
'char'.
Error in arduinotest (line 4)
a=arduino('COM4');
4 Comments
Bhagyashri Dengale
on 11 Mar 2018
a=arduino('uno') Undefined function 'arduino' for input arguments of type 'char'.
Geoff Hayes
on 11 Mar 2018
This error message is telling you that the arduino function cannot be found. You mention that you have installed arduino successfully, but perhaps you need to add the location of this package to your MATLAB search path.
Accepted Answer
Geoff Hayes
on 9 Nov 2014
Zack - the error message is suggesting that you don't have a function named arduino that accepts a char/string input. In the Command Window, type
which arduino -all
to find that function. What do you see? Since I've installed the Arduino support package, I observe
/Users/geoff/Documents/MATLAB/SupportPackages/R2014a/arduinoio/arduino.m % arduino constructor
If you haven't installed the support package, then see the link Arduino Support from MATLAB for details. You may want to download the support package, then start MATLAB as an administrator, and launch the support package from within MATLAB to get it to install (and work) properly. You may also want to read the link installing hardware support package for Arduino for other information too (not all of which will be applicable for you though).
More Answers (0)
See Also
Categories
Find more on 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!