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.
 

53 lines
1.3 KiB

#!/usr/bin/python
import sys #reconocer lo que hay en la terminal
import time
LED_PATH = "/sys/class/leds/beaglebone:green:usr3"
def writeLED(fileName, value, path=LED_PATH):
"""
Ayuda de la rutina
writeLED(fileName, value, path=LED_PATH)
"""
fo = open(path + fileName, "w")
fo.write(value)
fo.close()
return
def removeTrigger():
writeLED("/trigger","none")
return
print("Starting App")
#removeTrigger()
#writeLED("/brightness", "1")
#print("LED3 on")
#print("Finish App")
if len(sys.argv)!=2:
print("Incorrect number of arguments")
sys.exit(2)
if sys.argv[1] == "on":
print("LED on")
removeTrigger()
writeLED("/brightness", "1")
print("LED3 on")
elif sys.argv[1] == "off":
print("LED off")
removeTrigger()
writeLED("/brightness", "0")
print("LED3 off")
elif sys.argv[1]=="b":
print("blinking")
removeTrigger()
writeLED("/trigger", "timer")
writeLED("/delay_on","500")
writeLED("/delay_off","500")
else:
print("Wrong command!!!")
print("Wrong command!!!")
print("To turn on the LED please type: ./led.py on")
print("To turn off the LED please type: ./led.py off")
print("To make the LED blink please type: ./led.py b")
print("Script done")