#!/bin/bash
|
|
LED3_PATH=/sys/class/leds/beaglebone:green:usr3
|
|
|
|
function removeTrigger
|
|
{
|
|
echo "none" >> "$LED3_PATH/trigger"
|
|
}
|
|
|
|
echo "The LED3 user is starting"
|
|
if [ "$1" == "on" ]; then
|
|
echo "LED on"
|
|
removeTrigger
|
|
echo "1" >> "$LED3_PATH/brightness"
|
|
elif [ "$1" == "off" ]; then
|
|
echo "LED off"
|
|
removeTrigger
|
|
echo "0" >> "$LED3_PATH/brightness"
|
|
elif [ "$1" == "blink" ]; then
|
|
"LED blinking"
|
|
removeTrigger
|
|
echo "1" >> "$LED3_PATH/brightness"
|
|
sleep 0.5
|
|
echo "0" >> "$LED3_PATH/brightness"
|
|
sleep 0.5
|
|
elif [ "$1" == "help" ]; then
|
|
echo "This is an application to control User LED 3"
|
|
echo "List of commands: "
|
|
echo "on - Powers on the LED"
|
|
echo "off - Powers off the LED"
|
|
echo "blink - Makes the LED blink"
|
|
|
|
else
|
|
echo "Error: This is not a command for this application"
|
|
echo "These are the commands you can use: "
|
|
echo "on - Powers on the LED"
|
|
echo "off - Powers off the LED"
|
|
echo "blink - Makes the LED blink"
|
|
fi
|
|
echo "Done"
|