Remove servo
import time
import board
-import simpleio
+import pulseio
+from adafruit_motor import servo
-# For the M0 boards:
-servo = simpleio.Servo(board.A2)
-# For the M4 boards:
-# servo = simpleio.Servo(board.A1)
+# create a PWMOut object on Pin 13.
+pwm = pulseio.PWMOut(board.D13, duty_cycle=2 ** 15, frequency=50)
+
+# Create a servo object, my_servo.
+my_servo = servo.Servo(pwm)
while True:
- for angle in range(0, 180, 5): # 0-180 degrees, 5 degrees at a time
- servo.angle = angle
+ for angle in range(0, 180, 5): # 0 - 180 degrees, 5 degrees at a time.
+ my_servo.angle = angle
time.sleep(0.05)
- for angle in range(180, 0, -5): # 180-0 degrees, 5 degrees at a time
- servo.angle = angle
+ for angle in range(180, 0, -5): # 180 - 0 degrees, 5 degrees at a time.
+ my_servo.angle = angle
time.sleep(0.05)
