Library 'Servo' is not uploaded to the board ERROR
조회 수: 2 (최근 30일)
이전 댓글 표시
I keep getting this error message when trying to run my code, I'm confident my wiring is correct and I do not know what this error means-
Library 'Servo' is not uploaded to the board. Clear the current Arduino object and recreate it to include the appropriate library. For a list of available libraries, type 'listArduinoLibraries'.
here is my code
a=arduino();
s1 = servo(a, 'D9', 'MinPulseDuration', 700*10^-6, 'MaxPulseDuration', 2300*10^-6);
writePosition(s1,0);
userResponse = "yes";
while userResponse == "yes"
chicken = input("Insert your resistor");
voltage = readVoltage(a, "A0");
if voltage < 1.67155
resistor = "47k";
writePosition(s1,0.25);
minR = 47000 * 0.95;
maxR = 47000 * 1.05;
elseif voltage < 3.53128
resistor = "10k";
writePosition(s1,0.5);
minR = 10000 * 0.95;
maxR = 10000 * 1.05;
elseif voltage < 4.69941
resistor = "1k";
writePosition(s1,0.75);
minR = 1000 * 0.95;
maxR = 1000 * 1.05;
else
resistor = "330";
writePosition(s1,1);
minR = 330 * 0.95;
maxR = 330 * 1.05;
end
resistance = voltageToResistance(voltage);
withinTolerance = (resistance >= minR && resistance <= maxR);
disp(resistor)
if withinTolerance == 1
writeDigitalPin(a, "D4", 1);
writeDigitalPin(a, "D5", 0);
%disp("green")
else
writeDigitalPin(a, "D4", 0);
writeDigitalPin(a, "D5", 1);
%disp("Red")
end
userResponse = input("Would you like to check another resistor? ","s");
writePosition(s1,0);
writeDigitalPin(a, "D4", 0);
writeDigitalPin(a, "D5", 0);
end
댓글 수: 0
답변 (1개)
James Bittner
2024년 1월 12일
When you go to connect to the arduino you will need to request any libraries that you will be utilizing.
Two ways to achieve this:
or
-run the
>>arduinosetup
command and select the 'Servo' library when you initially program the board in the GUI
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Arduino Hardware에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!