blink.py 310 B

1234567891011121314
  1. #!/usr/bin/python3
  2. import time, os, sys
  3. os.chdir("/sys/class/gpio/")
  4. os.system("echo {} > export".format(sys.argv[1]))
  5. os.chdir("gpio{}".format(sys.argv[1]) )
  6. os.system("echo out > direction")
  7. for i in range(20):
  8. os.system("echo 1 > value")
  9. time.sleep(1)
  10. os.system("echo 0 > value")
  11. time.sleep(0.2)