Arduino Error: Too many output arguments

2 Ansichten (letzte 30 Tage)
Halil
Halil am 18 Jun. 2021
Bearbeitet: Bhavya Chopra am 7 Jul. 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!

Antworten (1)

Bhavya Chopra
Bhavya Chopra am 6 Jul. 2021
Bearbeitet: Bhavya Chopra am 7 Jul. 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

Kategorien

Mehr zu Arduino Hardware finden Sie in Help Center und File Exchange

Produkte


Version

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by