From 8b423f361b9ef0d8b13f5b0bd05dd6f4e32bbb88 Mon Sep 17 00:00:00 2001 From: Georgios Gerontakis Date: Sat, 11 Jan 2020 17:35:57 +0200 Subject: [PATCH] fixed indent Signed-off-by: Georgios Gerontakis --- camera module/servo.py | 52 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/camera module/servo.py b/camera module/servo.py index e30a23d..ccb226d 100644 --- a/camera module/servo.py +++ b/camera module/servo.py @@ -2,33 +2,29 @@ import RPi.GPIO as GPIO #import GPIO Module 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 - pwm.start(0) # start with 0 duty ccle (sets no angles on startup) - duty = angle / 18 + 2 - GPIO.output(03, True) - pwm.ChangeDutyCycle(duty) - sleep(1) - GPIO.output(03, False) - pwm.ChangeDutyCycle(0) - pwm.stop() - GPIO.cleanup() + GPIO.setmode(GPIO.BOARD) #pins naming + 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(3, True) + pwm.ChangeDutyCycle(duty) + sleep(1) + 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 - pwm.start(0) # start with 0 duty ccle (sets no angles on startup) - duty = angle / 18 + 2 - GPIO.output(05, True) - pwm.ChangeDutyCycle(duty) - sleep(1) - GPIO.output(05, False) - pwm.ChangeDutyCycle(0) - pwm.stop() - GPIO.cleanup() - - -SetAngleDown(100) -SetAngleUp(100) \ No newline at end of file + GPIO.setmode(GPIO.BOARD) #pins naming + 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(5, True) + pwm.ChangeDutyCycle(duty) + sleep(1) + GPIO.output(5, False) + pwm.ChangeDutyCycle(0) + pwm.stop() + GPIO.cleanup() \ No newline at end of file