ACT Blink

This commit is contained in:
ABelliqueux 2022-10-24 19:42:11 +02:00
parent 41ab6e4b1b
commit 8f2f5711ea
1 changed files with 8 additions and 2 deletions

10
app.py
View File

@ -66,11 +66,17 @@ def getRSSI():
# Blink the Pi led to allow identification
def blinkPy():
# disable mmc access led
os.system('echo none | sudo tee /sys/class/leds/led0/trigger')
# Blink 10 times
for j in range(10):
os.system('echo 1 | sudo dd status=none of=/sys/class/leds/led0/brightness > /dev/null 2>&1') # led on
# TODO : add dd to NOPASSWD in /etc/sudoers.d/010...
os.system('echo 1 | sudo tee /sys/class/leds/led0/brightness') # led on
time.sleep(.2)
os.system('echo 0 | sudo dd status=none of=/sys/class/leds/led0/brightness > /dev/null 2>&1') # led off
os.system('echo 0 | sudo tee /sys/class/leds/led0/brightness') # led off
time.sleep(.2)
# restore default behavior
os.system('echo mmc0 | sudo tee /sys/class/leds/led0/trigger')
return "OK"