Arduino Error: Too many output arguments

2 ビュー (過去 30 日間)
Halil
Halil 2021 年 6 月 18 日
編集済み: Bhavya Chopra 2021 年 7 月 7 日
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!

回答 (1 件)

Bhavya Chopra
Bhavya Chopra 2021 年 7 月 6 日
編集済み: Bhavya Chopra 2021 年 7 月 7 日
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

カテゴリ

Help Center および File ExchangeArduino Hardware についてさらに検索

タグ

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by