Error trying to turn on arduino

13 views (last 30 days)
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
Bhagyashri Dengale on 11 Mar 2018
a=arduino('uno') Undefined function 'arduino' for input arguments of type 'char'.
Geoff Hayes
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.

Sign in to comment.

Accepted Answer

Geoff Hayes
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).
  1 Comment
Zack Bayhan
Zack Bayhan on 14 Nov 2014
Geoff, Thanks for the help I finally got a little time to play around with it and make the proper changes and works just fine now. Now I just have to read up on working with some pid controllers, steeper motors, and h-bridges. Thanks again. Zack

Sign in to comment.

More Answers (0)

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!