Browse Source

Help added to terminal on script, Readme modified

master
Gustavo Martinez 2 years ago
parent
commit
81e28cc903
2 changed files with 47 additions and 7 deletions
  1. +35
    -5
      Readme.md
  2. +12
    -2
      main.c

+ 35
- 5
Readme.md View File

@ -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
```

+ 12
- 2
main.c View File

@ -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;


Loading…
Cancel
Save