def forward(wait):
GPIO.setmode(GPIO.BCM) GPIO.setup(16,GPIO.OUT) #motor1 GPIO.setup(23,GPIO.OUT) #motor1 GPIO.setup(20,GPIO.OUT) #enable GPIO.setup(21,GPIO.OUT) #enable GPIO.setup(1,GPIO.OUT) #motor2 GPIO.setup(7,GPIO.OUT) #motor2 try: print("forward") GPIO.output(1,GPIO.HIGH) GPIO.output(7,GPIO.LOW) GPIO.output(21,GPIO.HIGH) GPIO.output(20,GPIO.LOW) GPIO.output(23,GPIO.LOW) GPIO.output(16,GPIO.LOW) for k in range(wait): print(k) time.sleep(1) GPIO.output(1,GPIO.LOW) GPIO.output(21,GPIO.LOW) except KeyboardInterrupt: print("keyboard interrupt") except Exception as err: print(err) finally: print("zero") GPIO.output(1,GPIO.LOW) GPIO.output(7,GPIO.LOW) GPIO.output(20,GPIO.LOW) GPIO.output(21,GPIO.LOW) GPIO.output(23,GPIO.LOW) GPIO.output(16,GPIO.LOW) #GPIO.cleanup() on my sbc it doesnt remove the +3V
def backward(wait):
GPIO.setmode(GPIO.BCM) GPIO.setup(20,GPIO.OUT) #enable GPIO.setup(21,GPIO.OUT) #enable GPIO.setup(1,GPIO.OUT) #motor2 GPIO.setup(7,GPIO.OUT) #motor2 GPIO.setup(16,GPIO.OUT) #motor1 GPIO.setup(23,GPIO.OUT) #motor1 try: print("backward") GPIO.output(21,GPIO.HIGH) GPIO.output(20,GPIO.LOW) GPIO.output(16,GPIO.LOW) GPIO.output(23,GPIO.LOW) GPIO.output(7,GPIO.HIGH) GPIO.output(1,GPIO.LOW) for k in range(wait): print(k) time.sleep(1) GPIO.output(7,GPIO.LOW) GPIO.output(21,GPIO.HIGH) except KeyboardInterrupt: print("keyboardinterrupt") except Exception as err: print(err) finally: print("zero") GPIO.output(20,GPIO.LOW) GPIO.output(21,GPIO.LOW) GPIO.output(16,GPIO.LOW) GPIO.output(23,GPIO.LOW) GPIO.output(1,GPIO.LOW) GPIO.output(7,GPIO.LOW) #GPIO.cleanup() on my sbc it doesnt remove the +3V
Vous avez entré un nom de page invalide, avec un ou plusieurs caractères suivants :
< > @ ~ : * € £ ` + = / \ | [ ] { } ; ? #