Error trying to turn on arduino

조회 수: 13 (최근 30일)
Zack Bayhan
Zack Bayhan 2014년 11월 9일
댓글: Geoff Hayes 2018년 3월 11일
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
Bhagyashri Dengale
Bhagyashri Dengale 2018년 3월 11일
a=arduino('uno') Undefined function 'arduino' for input arguments of type 'char'.
Geoff Hayes
Geoff Hayes 2018년 3월 11일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Geoff Hayes
Geoff Hayes 2014년 11월 9일
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
Zack Bayhan
Zack Bayhan 2014년 11월 14일
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

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by