Open tonilopezmr opened 6 years ago
SG90 9 g Micro Servo documentation Video explanation
This code move to neutral position (2.5) to 90º (6.25) if you want to move 180º then is (12.5).
import RPi.GPIO as GPIO import time GPIO_PIN = 8 GPIO.setmode(GPIO.BOARD) GPIO.setup(GPIO_PIN, GPIO.OUT) p = GPIO.PWM(GPIO_PIN, 50) p.start(2.5) p.ChangeDutyCycle(2.5) time.sleep(1) p.ChangeDutyCycle(7.25) time.sleep(1) p.ChangeDutyCycle(2.5) time.sleep(1) p.stop() GPIO.cleanup()
References
SG90 9 g Micro Servo documentation Video explanation
Code
This code move to neutral position (2.5) to 90º (6.25) if you want to move 180º then is (12.5).