Pin-Test.py 325 B

123456789101112131415161718192021
  1. #!/usr/bin/python
  2. # -*- coding: utf-8 -*-
  3. import time
  4. import RPi.GPIO as GPIO
  5. Output = 18 # GPIO24 = Pin 18
  6. GPIO.setmode(GPIO.BOARD)
  7. GPIO.setup(Output, GPIO.OUT)
  8. time.sleep(1)
  9. try:
  10. while(1):
  11. GPIO.output(Output, 1)
  12. GPIO.output(Output, 0)
  13. except KeyboardInterrupt:
  14. pass
  15. finally:
  16. GPIO.cleanup()