import RPi.GPIO as GPIO
from time import sleep
motor1= 17
motor2= 22
GPIO.setmode(GPIO.BCM)
GPIO.setup(motor1, GPIO.OUT)
GPIO.setup(motor2, GPIO.OUT)
def hacia_delante():
GPIO.output(motor1, GPIO.HIGH)
GPIO.output(motor2, GPIO.LOW)
def hacia_atras():
GPIO.output(motor1, GPIO.LOW)
GPIO.output(motor2, GPIO.HIGH)
def quieto():
GPIO.output(motor1, GPIO.LOW)
GPIO.output(motor1, GPIO.LOW)
try:
hacia_delante()
sleep(2)
hacia_atras()
sleep(2)