Error trying to turn on arduino

13 visualizaciones (últimos 30 días)
Zack Bayhan
Zack Bayhan el 9 de Nov. de 2014
Comentada: Geoff Hayes el 11 de Mzo. de 2018
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 comentarios
Bhagyashri Dengale
Bhagyashri Dengale el 11 de Mzo. de 2018
a=arduino('uno') Undefined function 'arduino' for input arguments of type 'char'.
Geoff Hayes
Geoff Hayes el 11 de Mzo. de 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.

Iniciar sesión para comentar.

Respuesta aceptada

Geoff Hayes
Geoff Hayes el 9 de Nov. de 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 comentario
Zack Bayhan
Zack Bayhan el 14 de Nov. de 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

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Arduino Hardware en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by