import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(4, GPIO.OUT)
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
a=GPIO.PWM(4,50)
a.start(5)
b=GPIO.PWM(17,50)
b.start(5)
c=GPIO.PWM(18,50)
c.start(5)
while True:
#c.ChangeDutyCycle(2.5)
a.ChangeDutyCycle(3)
b.ChangeDutyCycle(3)
c.ChangeDutyCycle(3)
print'0'
time.sleep(1)
a.ChangeDutyCycle(7.5)
b.ChangeDutyCycle(7.5)
c.ChangeDutyCycle(7.5)
print'90'
time.sleep(1)
a.ChangeDutyCycle(10)
b.ChangeDutyCycle(10)
c.ChangeDutyCycle(10)
print'180'
time.sleep(1)
沒有留言:
張貼留言