Consider the leds (the little lights) on your raspberry pi. These lights can be changed by sending messages to the device about how to behave.
The first script you are to write (which you must decompose into smaller scripts/functions) is to allow a user of your script to manipulate the leds on your pi.
When the script starts up, it will scan the contents of /sys/class/leds to get a list of the leds on the system (each link in this directory points to a directory for the settings of that led).
The two files we are interested in are “brightness” and “trigger”.
The scripting tasks:
Each of these scripting tasks must be in a separate function. It should have a sensible name to streamline maintainability (task1, task2, etc will be marked down) and should follow standard conventions such as paths to executables specified in variables at the top of the script, functions should only reference local variables UNLESS they represent shared state in the program (hardly any of these should so you need to make a case as to why you have done this in your README if you have).
You are required to check for errors after each command you enter and capture any output text into a variable. You should then output error messages in a reasonable format such as “This operation has failed:” followed by the error message that was output by the command.
You are required to disable the control-c interupt of the script and the script should handle any requests to quit gracefully. You should opt in all cases for the calling of programs to do work for you rather than performing operations in your script. For the purpose of these tasks you must restrict yourself to standard UNIX utilities.
Note that all submitted scripts must use bash and must specify the interpreter at the top of the script.
Task 2: Script launch (8 marks)
On start of your script it should read the contents of the /sys/class/leds directory and present a menu for your program. An example run of your program should look like:
Welcome to Led_Konfigurator!
Please select an led to configure:
Please enter a number (1-9) for the led to configure or quit:
Please note that hardcoding this menu will get you 0 marks. It must be generated from the contents of the /sys/class/leds directory.
Task 3: LED Manipulation Menu (10 Marks)
Create a function that will display a menu of options for any led selected which shall look like the following:
[LED NAME] <-- replace this name with the actual name of the led.
What would you like to do with this led?
1) turn on
2) turn off
3) associate with a system event
4) associate with the performance of a process
5) stop association with a process’ performance
6) quit to main menu
Please enter a number (1-6) for your choice:
Task 4: Turn on and off the led (4 Marks)
The “turn on” command above echoes 1 into the brightness file for the respective led and the “turn off” command echoes 0 into the brightness file.
Task 5: Associate LED with a system event (10 Marks)
The associate with a system event menu will list the events from the trigger file with a * next to the currently selected event. So the menu for that option would look like (next page):
Please note that if the options on the menu scroll off the screen, you are required to page the menu with more. Please note that hard coding this menu will get you 0 marks. It must be dynamically generated from the contents of the trigger file.
All functions must be appropriately comments with a header comment for each function describing parameters and the expected outcome of the function. There must be a reasonable number of comments in your program so that it is clear what you intention is. Also, you must provide a readme file that explains how we can use your program
I have done Bash menus, and will write the script with very high quality - functions, comments, local variables, etc.
8 freelanceri licitează în medie 175$ pentru acest proiect
Hi, SIR I have developed some Raspberry PI projects in these days. I am experts in embedding programming, Raspberry PI, and so on. I can do my best and I have testing devices. Hope to work for you. Thanks Gao
https://www.freelancer.com/projects/php/Temperature-monitoring-tool-for-toy/ https://www.freelancer.com/projects/php/License-Plate-Detection-With-Chinese/ done the similar jobs lets chat
Dear Employer, How are you? As you can see in my profile, I have great experience in C/C++, C#, and Java programming as well as Microcontroller. Especially, I have completed many Raspberry Pi and Arduino projects and Mai multe
Hello, Looks like an interesting project in shell script. You can refer my profile and if interested please contact me. I can share my previous works on shell scripts or you can find the reviews here. I need acce Mai multe
I have worked on scripts like this a bit when developing test/build systems for various projects. I may need a few days to get my hands on a PI but after that, I can deliver the code to you for in a day. This small tas Mai multe
I've been a systems and software engineer for nearly a decade. I write shell scripts in many different scripting languages, in a large corporate environment, every day. Bash is currently one of my strongest and most en Mai multe