Browse Source

fixed indent

Signed-off-by: Georgios Gerontakis <giwrgosgprog@gmail.com>
master
Georgios Gerontakis 5 years ago
parent
commit
8b423f361b
  1. 20
      camera module/servo.py

20
camera module/servo.py

@ -3,32 +3,28 @@ from time import sleep #sleep command
def SetAngleUp(angle):
GPIO.setmode(GPIO.BOARD) #pins naming
GPIO.setup(03, GPIO.OUT) #PWM signal output (GPIO2)
pwm=GPIO.PWM(03, 50) #50Hz PWM on pin
GPIO.setup(3, GPIO.OUT) #PWM signal output (GPIO2)
pwm=GPIO.PWM(3, 50) #50Hz PWM on pin
pwm.start(0) # start with 0 duty ccle (sets no angles on startup)
duty = angle / 18 + 2
GPIO.output(03, True)
GPIO.output(3, True)
pwm.ChangeDutyCycle(duty)
sleep(1)
GPIO.output(03, False)
GPIO.output(3, False)
pwm.ChangeDutyCycle(0)
pwm.stop()
GPIO.cleanup()
def SetAngleDown(angle):
GPIO.setmode(GPIO.BOARD) #pins naming
GPIO.setup(05, GPIO.OUT) #PWM signal output (GPIO3)
pwm=GPIO.PWM(05, 50) #50Hz PWM on pin
GPIO.setup(5, GPIO.OUT) #PWM signal output (GPIO3)
pwm=GPIO.PWM(5, 50) #50Hz PWM on pin
pwm.start(0) # start with 0 duty ccle (sets no angles on startup)
duty = angle / 18 + 2
GPIO.output(05, True)
GPIO.output(5, True)
pwm.ChangeDutyCycle(duty)
sleep(1)
GPIO.output(05, False)
GPIO.output(5, False)
pwm.ChangeDutyCycle(0)
pwm.stop()
GPIO.cleanup()
SetAngleDown(100)
SetAngleUp(100)
Loading…
Cancel
Save