Automatic door project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

manage_gpio.py 574B

123456789101112131415161718192021222324
  1. from RPi import GPIO
  2. import time
  3. GPIO.setmode(GPIO.BOARD)
  4. GPIO.setup(38, GPIO.OUT, initial=GPIO.LOW)
  5. GPIO.setup(40, GPIO.OUT, initial=GPIO.LOW)
  6. try:
  7. while True:
  8. GPIO.output(38, GPIO.LOW)
  9. time.sleep(0.3)
  10. GPIO.output(40, GPIO.HIGH)
  11. time.sleep(0.3)
  12. GPIO.output(40, GPIO.LOW)
  13. time.sleep(0.3)
  14. for _ in range(150):
  15. GPIO.output(38, GPIO.HIGH)
  16. time.sleep(0.002)
  17. GPIO.output(38, GPIO.LOW)
  18. time.sleep(0.2)
  19. time.sleep(5)
  20. except KeyboardInterrupt:
  21. GPIO.cleanup()