Adafruit_Learning_System_Gu.../MetroX_CircuitPython/servo/code.py
2022-02-22 13:45:02 -05:00

24 lines
476 B
Python
Executable file

# SPDX-FileCopyrightText: 2021 Brent Rubell for Adafruit Industries
#
# SPDX-License-Identifier: MIT
"""
'servo.py'.
=================================================
move a hobby servo (towerpro sg92r) w/ 3-wire interface
requires:
- Adafruit_CircuitPython_Motor
"""
import time
import board
import pwmio
from adafruit_motor import servo
SERVO = servo.Servo(pwmio.PWMOut(board.D9))
while True:
SERVO.angle = 0
time.sleep(2)
SERVO.angle = 90
time.sleep(2)