程序简单易读,不再做注释
motor.py
from gpiozero import Motor from gpiozero import LED led = LED(2) motor = Motor(20, 21) while True: led.on() motor.forward()
servo.py
from gpiozero import Servo from time import sleep servo = Servo(17) while True: servo.min() sleep(1) servo.mid() sleep(1) servo.max() sleep(1)
Smartkeke