Joy-it RB-P-XPLR-SET handleiding

37 pagina's
PDF beschikbaar

Handleiding

Je bekijkt pagina 13 van 37
. SERVOS
A servo consists of an electric motor with gearbox and control electronics. On the output side of the gearbox there is a gear wheel on which the servo horn is
mounted. Servos are used in model making, for example to control the wing or rudder position of an airplane or ship. More and more servos are also being
used in automotive engineering to automatically close doors, for window regulators, mirrors and other adjustable elements.
The servo connections are the GPIO pins GP7, GP8, GP9 and GP20.
from machine import Pin, PWM
from utime import sleep
# Servo pin numbers
servoOnePin = 7
servoTwoPin = 8
servoThreePin = 9
servoFourPin = 20
# Initialize servos
servoOne = PWM(Pin(servoOnePin))
servoTwo = PWM(Pin(servoTwoPin))
servoThree = PWM(Pin(servoThreePin))
servoFour = PWM(Pin(servoFourPin))
# Servo degree positions in nanoseconds
deg0 = 500000
deg45 = 1000000
deg90 = 1500000
deg135 = 2000000
deg180 = 2500000
while True:
# Move each servo through a range of angles
for servo in [servoOne, servoTwo, servoThree, servoFour]:
servo.duty_ns(deg0)
sleep(1)
servo.duty_ns(deg45)
sleep(1)
servo.duty_ns(deg90)
sleep(1)
servo.duty_ns(deg135)
sleep(1)
servo.duty_ns(deg180)
sleep(1)
13

Bekijk gratis de handleiding van Joy-it RB-P-XPLR-SET, stel vragen en lees de antwoorden op veelvoorkomende problemen, of gebruik onze assistent om sneller informatie in de handleiding te vinden of uitleg te krijgen over specifieke functies.

Productinformatie

MerkJoy-it
ModelRB-P-XPLR-SET
CategorieNiet gecategoriseerd
TaalNederlands
Grootte21690 MB