Browse Source

Help on terminal added to the script, Readme.md modified

master
Gustavo Martinez 2 years ago
parent
commit
0458345cdc
2 changed files with 42 additions and 11 deletions
  1. +24
    -6
      Readme.md
  2. +18
    -5
      blink_LED3.sh

+ 24
- 6
Readme.md View File

@ -38,6 +38,10 @@ En la parte principal de nuestro código, se inicia un ciclo if que evaluará lo
controlará modificando el registro *brightness* con el comando *echo*, para el parpadeo del controlará modificando el registro *brightness* con el comando *echo*, para el parpadeo del
LED se usará el comando *sleep* que definirá el tiempo de inicio y apagado en segundos. LED se usará el comando *sleep* que definirá el tiempo de inicio y apagado en segundos.
Si el usuario no conoce los comandos, puede usar *help* para desplegar la lista de los comandos anteriormente
mencionados, o bien al ingresar un comando erróneo saldrá una alerta que indicará que el comando es incorrecto y
mostrará todos los comandos a usar.
```console ```console
echo "The LED3 user is starting" echo "The LED3 user is starting"
if [ "$1" == "on" ]; then if [ "$1" == "on" ]; then
@ -49,13 +53,27 @@ echo "The LED3 user is starting"
removeTrigger removeTrigger
echo "0" >> "$LED3_PATH/brightness" echo "0" >> "$LED3_PATH/brightness"
elif [ "$1" == "blink" ]; then elif [ "$1" == "blink" ]; then
"LED blinking"
removeTrigger
echo "1" >> "$LED3_PATH/brightness"
sleep 0.5
echo "0" >> "$LED3_PATH/brightness"
sleep 0.5
"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 fi
echo "Done" echo "Done"
``` ```


+ 18
- 5
blink_LED3.sh View File

@ -7,20 +7,33 @@ function removeTrigger
} }
echo "The LED3 user is starting" echo "The LED3 user is starting"
if [ "$1" == "on" ]; then
if [ "$1" == "on" ]; then
echo "LED on" echo "LED on"
removeTrigger removeTrigger
echo "1" >> "$LED3_PATH/brightness" echo "1" >> "$LED3_PATH/brightness"
elif [ "$1" == "off" ]; then
elif [ "$1" == "off" ]; then
echo "LED off" echo "LED off"
removeTrigger removeTrigger
echo "0" >> "$LED3_PATH/brightness" echo "0" >> "$LED3_PATH/brightness"
elif [ "$1" == "blink" ]; then
elif [ "$1" == "blink" ]; then
"LED blinking" "LED blinking"
removeTrigger removeTrigger
echo "1" >> "$LED3_PATH/brightness" echo "1" >> "$LED3_PATH/brightness"
sleep 0.5 sleep 0.5
echo "0" >> "$LED3_PATH/brightness" echo "0" >> "$LED3_PATH/brightness"
sleep 0.5 sleep 0.5
fi
echo "Done"
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"

Loading…
Cancel
Save