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.
Genuino Uno and servo issue on Macbook Pro
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Niccolò de Cesare
am 7 Jul. 2016
Beantwortet: Niccolò de Cesare
am 8 Jul. 2016
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
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu MATLAB Support Package for Arduino Hardware finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!