Arduino Error: Too many output arguments

2 visualizzazioni (ultimi 30 giorni)
Halil
Halil il 18 Giu 2021
Modificato: Bhavya Chopra il 7 Lug 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!

Risposte (1)

Bhavya Chopra
Bhavya Chopra il 6 Lug 2021
Modificato: Bhavya Chopra il 7 Lug 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

Categorie

Scopri di più su Arduino Hardware in Help Center e File Exchange

Prodotti


Release

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by