필터 지우기
필터 지우기

Genuino Uno and servo issue on Macbook Pro

조회 수: 1 (최근 30일)
Niccolò de Cesare
Niccolò de Cesare 2016년 7월 7일
답변: Niccolò de Cesare 2016년 7월 8일
Hi everybody,
i've a problem with Genuino Uno on a MacBook Pro Retina 15, i've to control a Servo Motor (Savox SC-1268SG) and after i have created an object Arduino, with the following code:
a = arduino('/dev/tty.usbmodem1421','Uno', 'Libraries', 'Servo')
i create the servo object with:
s = servo(a, 'D3', 'MinPulseDuration', 1000*10^-6, 'MaxPulseDuration', 2000*10^-6)
on digital pin 3 (PWM).
Theoretically with the command:
writePosition(s, 1)
the servo should move on the MaxPulseDuration that correspond to 100° instead MATLAB returns this message:
"The host and client connection is lost. Make sure the board is plugged in and recreate arduino and related objects."
conversely if i move the servo with pitch 0.01 from the initial position: 0.5, 0.51, 0.52, etc. with the command line, servo moves; instead if i use a for cycle:
for i=0.5:0.01:1
writePosition(s, i);
end
MATLAB returns the same error message above. Instead if i add pause(5e-5) after writePosition(s,i) seems to work.
I don't understand this issue.
Anyone know why happens? Probably issue is MacBook correlated?
Thank you in advance

채택된 답변

Niccolò de Cesare
Niccolò de Cesare 2016년 7월 8일
The problem was related to insufficient power supply from Arduino through the 5V pin, high voltage servo Savox needs much more current compared to current that Arduino can provide if is connected on PC USB. I've connected an external power supply setted on 7.5 V (maximum current 1000mA) using Arduino's Jack and all works well.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB Support Package for Arduino Hardware에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by