Come programmare un motore a 5 pin con Raspberry PI
-
20-12-2019 - |
Domanda
Sono di recente lavoro su un progetto in cui voglio controllare un servomotore a 5 pin con Raspberry Pi.
Ho cercato risorse e trovò il servomotore di Adafruit con solo 3 PIN.Questo è il link per Servomotore a 3 pin Adafruit
Problema :
Qual è la differenza tra un servomotore da 5 pin e 3 pin?
Se entrambi sono uguali cos'è il diagramma Pin Out per questo servomotore da 5 pin?
Questo è il codice sorgente per il servomotore a 3 pin.
# Servo Control
import time
def set(property, value):
try:
f = open("/sys/class/rpi-pwm/pwm0/" + property, 'w')
f.write(value)
f.close()
except:
print("Error writing to: " + property + " value: " + value)
def setServo(angle):
set("servo", str(angle))
set("delayed", "0")
set("mode", "servo")
set("servo_max", "180")
set("active", "1")
delay_period = 0.01
while True:
for angle in range(0, 180):
setServo(angle)
time.sleep(delay_period)
for angle in range(0, 180):
setServo(180 - angle)
time.sleep(delay_period)
.
Quali modifiche devo fare per controllare un servomotore a 5 pin?Ci sono modifiche importanti?
Soluzione
Non è un servo.È un motore passo-passo 5 Pin, è necessario anche un driver UNI-Polar
Altri suggerimenti
I found out that, well u can connect a stepper motor or servo motor or dc motor for your Raspbberi Pi. Check the link for adafruit's stepper motor connection to raspberry pi.
Raspberry Pi stepper motor connection
If u see some more lessons you will find that you can connect dc,stepper or servo motor to your Pi.