Arduino Error: Too many output arguments

2 visualizaciones (últimos 30 días)
Halil
Halil el 18 de Jun. de 2021
Editada: Bhavya Chopra el 7 de Jul. de 2021
clear all;
a = arduino;
i=0;
while 1
pot=analogRead(a,0)
pot1=analogRead(a,1)
pot2=analogRead(a,2)
pot3=analogRead(a,3)
pot4=analogRead(a,4)
pause(0.5);
if pot4>700
s=servoWrite(a,'D11')
writePosition(s,0);
pause(0.5);
writePosition(s,0.5);
pause(0.5);
writePosition(s,1);
end
i=i+1;
pause(1);
end
Thanks in advance for your help and time!

Respuestas (1)

Bhavya Chopra
Bhavya Chopra el 6 de Jul. de 2021
Editada: Bhavya Chopra el 7 de Jul. de 2021
The analogRead() method is not a part of the MATLAB Support Package for Arduino beyond release R2013b. For this, as a workaround you can use readVoltage method. It can be used for reading voltage from an analog pin on the Arduino hardware.
Also, please refer to the MATLAB answer attached below which might give you some idea: analogRead() for class arduino
Further, the servoWrite() method is also part of the legacy support package for Arduino. Using the servo method for connecting to the servo motor might resolve the issue for releases R2014b onwards:
s = servo(a,'D11'); % Using servo method for servo object creation

Categorías

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

Etiquetas

Productos


Versión

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by