pid-balancer/Old/min-max-demo.py

26 lines
530 B
Python
Raw Normal View History

2024-12-16 15:25:32 +01:00
# Example Python Servo Script #1
# Once connected the easiest way to get your servo moving is to use the Gpiozero library in a Python script.
from gpiozero import Servo
from time import sleep
2024-12-25 16:52:07 +01:00
from gpiozero.pins.pigpio import PiGPIOFactory
2024-12-16 15:25:32 +01:00
2024-12-25 16:52:07 +01:00
my_factory = PiGPIOFactory()
myGPIO = 12
servo = Servo(myGPIO, pin_factory=my_factory)
2024-12-16 15:25:32 +01:00
while True:
servo.mid()
print("mid")
sleep(0.5)
servo.min()
print("min")
sleep(1)
servo.mid()
print("mid")
sleep(0.5)
servo.max()
print("max")
2024-12-18 13:45:00 +01:00
sleep(1)