This Plugin will help to add a servo motor to raspberry PI to use as a pet feeder. This has a single switch which need the script python command. This switch will automatically turned off after 1 second.
Create a python file to run the servo motor.
- nano feed.py
import RPi.GPIO as GPIO
from time import sleep
backward = 10
forward = 20 #Adjust these values yourself
GPIO.setmode(GPIO.BOARD)
GPIO.setup(11, GPIO.OUT)
servo1 = GPIO.PWM(11, 100)
servo1.start(backward)
sleep(1)
servo1.ChangeDutyCycle(forward)
sleep(1.5)
servo1.stop()
GPIO.cleanup()
exit()
- CRTL+x, Shift+Y
Add python3 [path to python file]