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 Center および File ExchangeArduino Hardware についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by