diff --git a/Readme.md b/Readme.md index 4adf916..0585a25 100644 --- a/Readme.md +++ b/Readme.md @@ -85,11 +85,30 @@ el tiempo de encendido y apagado. writeLED("/delay_on", "500"); writeLED("/delay_off", "500"); } - +``` + +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. + +```C + else if (strcmp(argv[1], "help")==0){ + printf("This is an application to control User LED 3"); + printf("List of commands: "); + printf("on - Powers on the LED"); + printf("off - Powers off the LED"); + printf("blink - Makes the LED blink"); + } else - printf("Invalid command!\n"); + printf("Error: This is not a command for this application"); + printf("These are the commands you can use: "); + printf("on - Powers on the LED"); + printf("off - Powers off the LED"); + printf("blink - Makes the LED blink"); return 0; + } ``` @@ -114,7 +133,7 @@ void removeTrigger(){ } ``` -## Ejecución +## Ejecución y compilación Se compila el archivo main.c @@ -122,13 +141,24 @@ Se compila el archivo main.c gcc main.c -o led ``` -Se cambian los permisos de nuestro ejecutable. +Se asignan los permisos necesarios a nuestro ejecutable. ``` sudo chmod u+x led ``` -Y se ejecuta con cualquiera de los argumentos mencionados anteriormente. +Y se ejecuta con cualquiera de los argumentos disponibles. + +Encender el LED +``` +sudo ./led on +``` + +Apagar el LED +``` +sudo ./led off +``` +Parpadear el LED ``` sudo ./led blink ``` diff --git a/main.c b/main.c index d3d16b0..e0c5a18 100644 --- a/main.c +++ b/main.c @@ -41,9 +41,19 @@ int main(int argc, char* argv[]){ writeLED("/delay_on", "500"); writeLED("/delay_off", "500"); } - + else if (strcmp(argv[1], "help")==0){ + printf("This is an application to control User LED 3"); + printf("List of commands: "); + printf("on - Powers on the LED"); + printf("off - Powers off the LED"); + printf("blink - Makes the LED blink"); + } else - printf("Invalid command!\n"); + printf("Error: This is not a command for this application"); + printf("These are the commands you can use: "); + printf("on - Powers on the LED"); + printf("off - Powers off the LED"); + printf("blink - Makes the LED blink"); return 0;