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.

44 lines
993 B

  1. #!/usr/bin/python
  2. import sys #reconocer lo que hay en la terminal
  3. LED_PATH = "/sys/class/leds/beaglebone:green:usr3"
  4. def writeLED(fileName, value, path=LED_PATH):
  5. """
  6. Ayuda de la rutina
  7. writeLED(fileName, value, path=LED_PATH)
  8. """
  9. fo = open(path + fileName, "w")
  10. fo.write(value)
  11. fo.close()
  12. return
  13. def removeTrigger():
  14. writeLED("/trigger","none")
  15. return
  16. print("Starting App")
  17. if len(sys.argv)!=2:
  18. print("Incorrect number of arguments")
  19. sys.exit(2)
  20. if sys.argv[1] == "on":
  21. print("LED on")
  22. removeTrigger()
  23. writeLED("/brightness", "1")
  24. print("LED3 on")
  25. elif sys.argv[1] == "off":
  26. print("LED off")
  27. removeTrigger()
  28. writeLED("/brightness", "0")
  29. print("LED3 off")
  30. elif sys.argv[1] == "blink":
  31. print("LED blinking")
  32. while True:
  33. writeLED("/trigger", "timer")
  34. writeLED("/delay_on", "50")
  35. writeLED("/delay_off", "50")
  36. else:
  37. print("Wrong command!!!")
  38. print("Script done")