diff options
Diffstat (limited to 'recipes-demo/de10-nano-gpio-apps/files/toggle_fpga_leds.sh')
-rwxr-xr-x | recipes-demo/de10-nano-gpio-apps/files/toggle_fpga_leds.sh | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/recipes-demo/de10-nano-gpio-apps/files/toggle_fpga_leds.sh b/recipes-demo/de10-nano-gpio-apps/files/toggle_fpga_leds.sh new file mode 100755 index 0000000..8564a30 --- /dev/null +++ b/recipes-demo/de10-nano-gpio-apps/files/toggle_fpga_leds.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +LEDS=" +fpga_led0 +fpga_led1 +fpga_led2 +fpga_led3 +fpga_led4 +fpga_led5 +fpga_led6 +fpga_led7 +" + +# turn off all leds +for NEXT_LED in ${LEDS} +do + echo "none" > /sys/class/leds/${NEXT_LED}/trigger + echo "0" > /sys/class/leds/${NEXT_LED}/brightness +done + +# toggle the leds individually +for NEXT_LED in ${LEDS} ${LEDS} +do + cat /sys/class/leds/${NEXT_LED}/brightness | \ + tr '01' '10' > /sys/class/leds/${NEXT_LED}/brightness + usleep 125000 +done + |