Hi,
I have no experience with Linux and python, but thanks to http://aquaticus.info/beaglebone-web-led I’ve just written my first python scrip for the BBB .
As you can see at the end of the post, the code has one function to turn on, and other to turn off an onboard led.
The problem is that at the end of the script I’ve added a line to turn on the led. I wonder if I could use directly the functions "OnLed " and "OffLed " in the terminal without having to run a script with lines like “OnLed (2)”.
def writeDevice(device, value):
with open(device,“w”) as f:
f.write("%d\n" % int(value))
def OnLed (Led):
if Led in [0,1,2,3]:
writeDevice("/sys/class/leds/beaglebone:green:usr" + str(Led) + “/brightness”,1)
else:
print str(Led) + " is not correct value for a LED"
def OffLed (Led):
if Led in [0,1,2,3]:
writeDevice("/sys/class/leds/beaglebone:green:usr" + str(Led) + “/brightness”,0)
else:
print str(Led) + " is not correct value for a LED"
OnLed (2)
Thanks you in advance!