All pins reserved by Arduino servo
11 次查看(过去 30 天)
显示 更早的评论
clc
clear
triggerPin = 'D2';
echoPin = 'D3';
servoPin = 'D4';
port = 'COM5';
board = 'Nano3';
ledWhite = 'D9';
ledGreen = 'D10';
ledRed = 'D11';
k = 1;
a = arduino(port,board,'Libraries',{'Servo','Ultrasonic'});
configurePin(a,servoPin,'DigitalOutput')
configurePin(a,ledWhite,'DigitalOutput')
configurePin(a,ledRed,'DigitalOutput')
configurePin(a,servoPin,'Servo')
s = servo(a, servoPin, 'MinPulseDuration', 700*10^-6, 'MaxPulseDuration', 2300*10^-6);
Hello everyone,
In the above code snippet, I cannot run all the LED pins because they are all reserved by servo. I have tried configure pin method but this does not work. Could someone please help? Am running MATLAB 2021b.
Error:
"Nano3 Pin D9 is reserved by Servo. To release the resource, clear all variables holding onto this resource."
(Same error for all three pins)
2 个评论
Walter Roberson
2022-4-18
https://www.arduino.cc/reference/en/libraries/servo/ says that pins 9 and 10 are reserved, except 11 and 12 instead for Mega
采纳的回答
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!