65cba67ca2cc373cd89b8ba04b0e797f8769874f
haas/fall2026/c4eng/projects/gfoX.md
| ... | ... | @@ -0,0 +1,304 @@ |
| 1 | +# PROJECT: GRADE FIGURE-OUTERER (gfoX) |
|
| 2 | + |
|
| 3 | +## OBJECTIVE |
|
| 4 | + |
|
| 5 | +To successfully obtain, input, calculate, and derive your current overall |
|
| 6 | +status in the course through the use of a spreadsheet calculator. |
|
| 7 | + |
|
| 8 | +## BACKGROUND |
|
| 9 | + |
|
| 10 | +For this project, you will be using **Google Sheets** to create a |
|
| 11 | +spreadsheet and use it to tabulate and compute your current status in the |
|
| 12 | +class. |
|
| 13 | + |
|
| 14 | +You will need a Google account (a personal one is fine; if you use your |
|
| 15 | +school account, be mindful of any sharing restrictions that may apply). |
|
| 16 | +Sheets is accessed through your web browser at: |
|
| 17 | + |
|
| 18 | + * https://sheets.google.com |
|
| 19 | + |
|
| 20 | +No installation is required. You will still use your lab46 account to |
|
| 21 | +look up your results (see LOOK UP YOUR STATUS below), but the spreadsheet |
|
| 22 | +itself is built in the browser. |
|
| 23 | + |
|
| 24 | +## GOOGLE SHEETS BASICS |
|
| 25 | + |
|
| 26 | +If you have never used a spreadsheet before, here is what you need to get |
|
| 27 | +started. Google also has built-in help (Help menu -> Sheets Help) and a |
|
| 28 | +function list (Help -> Function list) you can reference at any time. |
|
| 29 | + |
|
| 30 | +### CELLS AND REFERENCES |
|
| 31 | + |
|
| 32 | +A spreadsheet is a grid of **cells**. Columns are lettered (A, B, C...) |
|
| 33 | +and rows are numbered (1, 2, 3...), so the cell in column B, row 4 is |
|
| 34 | +**B4**. Click a cell to select it, and type to enter data. |
|
| 35 | + |
|
| 36 | + * A cell whose contents start with `=` is a **formula**. |
|
| 37 | + * Formulas can reference other cells: `=B4+B5` |
|
| 38 | + * Formulas can reference a **range** of cells: `=SUM(B4:B9)` |
|
| 39 | + * Formulas update automatically when the cells they reference change. |
|
| 40 | + |
|
| 41 | +### USEFUL FUNCTIONS |
|
| 42 | + |
|
| 43 | +Some functions you will likely find helpful (there are others; explore!): |
|
| 44 | + |
|
| 45 | + * `SUM(range)`: add up all the numbers in a range |
|
| 46 | + * `MIN(a, b)`: the smaller of two values (useful for capping) |
|
| 47 | + * `MAX(a, b)`: the larger of two values |
|
| 48 | + * `ROUND(value, places)`: round to a number of decimal places |
|
| 49 | + * `IF(test, if_true, if_false)`: choose between two results |
|
| 50 | + * `IFS(test1, result1, test2, result2, ...)`: chain multiple tests |
|
| 51 | + * `VLOOKUP(key, range, column, is_sorted)`: look a value up in a table |
|
| 52 | + |
|
| 53 | +### FORMATTING |
|
| 54 | + |
|
| 55 | +Use the toolbar to make your spreadsheet readable: bold headers, borders, |
|
| 56 | +cell background colors, column widths, number formats (such as decimal |
|
| 57 | +places or percent). You can also merge cells for titles (Format -> Merge |
|
| 58 | +cells). |
|
| 59 | + |
|
| 60 | +### SAVING |
|
| 61 | + |
|
| 62 | +Google Sheets **saves automatically** as you work. Give your spreadsheet |
|
| 63 | +a meaningful name by clicking the title at the top left of the page (for |
|
| 64 | +example: `gfo0`). |
|
| 65 | + |
|
| 66 | +See the SUBMISSION section for how to get your finished work to me. |
|
| 67 | + |
|
| 68 | +## LOOK UP YOUR STATUS |
|
| 69 | + |
|
| 70 | +Ever since the first projects came due and were evaluated, your results |
|
| 71 | +were accessible to you on lab46 via the **status** command. |
|
| 72 | + |
|
| 73 | +The synopsis for the **status** command is: |
|
| 74 | + |
|
| 75 | +``` |
|
| 76 | +status DESIG [OPTION..] |
|
| 77 | +``` |
|
| 78 | + |
|
| 79 | +Where OPTION is any valid presence and combination of viable options |
|
| 80 | +(**detail** is one, **help** is another). |
|
| 81 | + |
|
| 82 | +The most common usage will probably be (square brackets in this context |
|
| 83 | +denote optionality): |
|
| 84 | + |
|
| 85 | +``` |
|
| 86 | +status DESIG [detail] |
|
| 87 | +``` |
|
| 88 | + |
|
| 89 | +Customize per the desired request. If you do not want the detailed view, |
|
| 90 | +omit the `detail` option. If you desire it, include the `detail` option. |
|
| 91 | + |
|
| 92 | +NOTE: **status** and the data it reads from are only accessible on lab46. |
|
| 93 | + |
|
| 94 | +``` |
|
| 95 | +lab46:~$ status DESIG |
|
| 96 | +``` |
|
| 97 | + |
|
| 98 | +Furthermore, if you were curious about the breakdown of points, you could |
|
| 99 | +also append the 'detail' argument to get an expanded view of information: |
|
| 100 | + |
|
| 101 | +``` |
|
| 102 | +lab46:~$ status DESIG detail |
|
| 103 | +``` |
|
| 104 | + |
|
| 105 | +NOTE: because 'detail' is an optional argument we use the square brackets |
|
| 106 | +to denote optionality. You do not type them, instead, you either type |
|
| 107 | +what is in them, or you do not, depending on desired functionality. |
|
| 108 | + |
|
| 109 | +## CALCULATING YOUR GRADE |
|
| 110 | + |
|
| 111 | +Your grade is calculated from four distinct components, three of which |
|
| 112 | +you regularly encounter each week through the semester, and the final one |
|
| 113 | +at the end. Each is worth a certain amount of overall points, that when |
|
| 114 | +added up equals 104 points. With their individual point values, they are: |
|
| 115 | + |
|
| 116 | + * projects (52 points) |
|
| 117 | + * notes (13 points) |
|
| 118 | + * participation (13 points) |
|
| 119 | + * eoce (26 points) |
|
| 120 | + |
|
| 121 | +Within each category, you tally up two different accumulations of points: |
|
| 122 | + |
|
| 123 | + * all the points YOU got |
|
| 124 | + * all the points POSSIBLE to get |
|
| 125 | + |
|
| 126 | +Each category (and the overall grade) is evaluated as a sum of points |
|
| 127 | +earned out of a sum of points possible (NOT an average of averages). |
|
| 128 | + |
|
| 129 | +For example, take this sample participation dataset: |
|
| 130 | + |
|
| 131 | +``` |
|
| 132 | +1:wcp1:final tally of results (1/1) |
|
| 133 | +2:wcp2:final tally of results (2/2) |
|
| 134 | +1:wcp3:final tally of results (1/4) |
|
| 135 | +5:wcp4:final tally of results (5/8) |
|
| 136 | +4:moar:final tally of results (4/0) |
|
| 137 | +``` |
|
| 138 | + |
|
| 139 | +This person got 1+2+1+5 points (and 4 bonus points), for a total of: 9 + |
|
| 140 | +4 = 13 points. |
|
| 141 | + |
|
| 142 | +The total amount of points available (at this point) was 1+2+4+8+0, or: |
|
| 143 | +15 points |
|
| 144 | + |
|
| 145 | +A note on 'bonus' points: in each category, there is the potential for |
|
| 146 | +the accumulation of bonus/extra/moar points. These are added into the |
|
| 147 | +mix, BUT for the purposes of grading, the final tally of YOUR points can |
|
| 148 | +NOT exceed the final tally of total points (bonus points only pad the |
|
| 149 | +category in which they were earned, and only up to that category's |
|
| 150 | +maximum). |
|
| 151 | + |
|
| 152 | +In this case, the person amassed 13 total points, out of a total of 15 |
|
| 153 | +points: for purposes of grading, for their participation score, it would |
|
| 154 | +be 13/15. Bonus points only apply to the particular category in which |
|
| 155 | +they were earned (they cannot be applied to a different category). |
|
| 156 | + |
|
| 157 | +Continuing this example, the person got 13/15ths of the 13 available |
|
| 158 | +points for that section (participation is worth 13 total points). We |
|
| 159 | +would calculate that "out of 13" result as follows: |
|
| 160 | + |
|
| 161 | +`(13/15)*13` = 11 (so at this point, they'd have 11 out of 13 |
|
| 162 | +participation points) |
|
| 163 | + |
|
| 164 | +Do the same for projects (52) and notes (13). For now, the total possible |
|
| 165 | +grade points you can receive is 78 total points (52+13+13). So that is |
|
| 166 | +what your spreadsheet should reflect. (EoCE does not exist yet, so it is |
|
| 167 | +not part of this calculation.) |
|
| 168 | + |
|
| 169 | +### LETTER GRADES |
|
| 170 | + |
|
| 171 | +Your letter grade is obtained by determining your score (out of 100) and |
|
| 172 | +selecting the letter grade pertaining to that value. Letter grades are |
|
| 173 | +pegged to the following numeric values (per the course syllabus): |
|
| 174 | + |
|
| 175 | +``` |
|
| 176 | +A 98.00+ |
|
| 177 | +A- 92.00 - 97.99 |
|
| 178 | +B+ 86.00 - 91.99 |
|
| 179 | +B 80.00 - 85.99 |
|
| 180 | +B- 74.00 - 79.99 |
|
| 181 | +C+ 68.00 - 73.99 |
|
| 182 | +C 62.00 - 67.99 |
|
| 183 | +D 56.00 - 61.99 |
|
| 184 | +F 0.00 - 55.99 |
|
| 185 | +``` |
|
| 186 | + |
|
| 187 | +Your score out of 100 is your current points out of 78, scaled to 100: |
|
| 188 | +`(your points / 78) * 100`. |
|
| 189 | + |
|
| 190 | +## SPREADSHEET |
|
| 191 | + |
|
| 192 | +For this project, your task is to make a spreadsheet in Google |
|
| 193 | +Sheets that, in clearly readable and organized fashion, plots out your |
|
| 194 | +various results on the different deliverables for the class, ultimately |
|
| 195 | +displaying your current overall grade for the course. |
|
| 196 | + |
|
| 197 | +I want to see each project (identified), along with the points you got, |
|
| 198 | +along with the total points possible for a "dashboard" quick glance, |
|
| 199 | +calculate your project "score" out of 100 (just to give you a feel for |
|
| 200 | +how you did on a particular project). Be sure to: |
|
| 201 | + |
|
| 202 | + * have a category for bonus points you have earned |
|
| 203 | + * have a projects score tally (all your points earned) |
|
| 204 | + * have a projects total tally (all the points possible to earn) |
|
| 205 | + |
|
| 206 | +Calculate your projects "score" out of 100 (just to give you a feel for |
|
| 207 | +how you did on the category overall). |
|
| 208 | + |
|
| 209 | +Calculate your projects "points" (out of 52), and display it under an |
|
| 210 | +identifiable label. |
|
| 211 | + |
|
| 212 | +Do the same for the participation and notes categories as well. |
|
| 213 | + |
|
| 214 | +Add up your category points (52+13+13=78), and have these be near each |
|
| 215 | +other in your spreadsheet. |
|
| 216 | + |
|
| 217 | +Calculate your actual current score for the class (based on a total of 78 |
|
| 218 | +points), and use a spreadsheet function (such as IFS or VLOOKUP) to |
|
| 219 | +determine from the letter grade ladder where you fall, displaying the |
|
| 220 | +resulting letter grade. |
|
| 221 | + |
|
| 222 | +Do NOTE: the aim and spirit of this project is to use the SPREADSHEET as |
|
| 223 | +the calculator. I want to see embedded equations, NOT pre-calculated |
|
| 224 | +values in your spreadsheet data. I do NOT want to see you being the |
|
| 225 | +calculator, pre-calculating all the values, and just entering them. That |
|
| 226 | +is NOT effective use of the spreadsheet. |
|
| 227 | + |
|
| 228 | +If you'd like to continue using this spreadsheet for additional points |
|
| 229 | +accrued in the coming weeks, you may want to plan ahead and set up your |
|
| 230 | +"final results" tally with some space away from the growing list of |
|
| 231 | +results (or on its own tab). Using ranges that have room to grow (for |
|
| 232 | +example, `SUM(B2:B30)`) can save you from having to rewrite formulas |
|
| 233 | +later. |
|
| 234 | + |
|
| 235 | +## TIME-SENSITIVE DATA |
|
| 236 | + |
|
| 237 | +gfoX is issued twice during the semester, and each iteration is to |
|
| 238 | +capture the following snapshot of data in its reporting results: |
|
| 239 | + |
|
| 240 | + * gfo0: start of semester through and including week 6 deliverables |
|
| 241 | + * gfo1: start of semester through and including week 12 deliverables |
|
| 242 | + |
|
| 243 | +There is a bit of a lag from the end of the sampling window and when that |
|
| 244 | +project is due: |
|
| 245 | + |
|
| 246 | + * gfo0 (through week 6 data) will be due alongside pct9/wcp9 |
|
| 247 | + * gfo1 (through week 12 data) will be due alongside pctE/wcpE |
|
| 248 | + |
|
| 249 | +Each iteration is a fresh snapshot: gfo1 should include everything from |
|
| 250 | +gfo0 plus the weeks since (weeks 1-12 in total). You are welcome to build |
|
| 251 | +gfo1 by copying your gfo0 spreadsheet and extending it (in Google Sheets: |
|
| 252 | +File -> Make a copy), as long as the final result is correct for the full |
|
| 253 | +week 1-12 window. |
|
| 254 | + |
|
| 255 | +## SUBMISSION |
|
| 256 | + |
|
| 257 | +To successfully complete this project, the following criteria must be |
|
| 258 | +met: |
|
| 259 | + |
|
| 260 | + * Solution must utilize the algorithm/approach presented above |
|
| 261 | + * Output must conform to the specifications presented above |
|
| 262 | + * Submit your solution by committing it to your private semester |
|
| 263 | + repository (NOT via the lab46 **submit** tool). |
|
| 264 | + |
|
| 265 | +Your finished spreadsheet needs to be exported from Google Sheets in a |
|
| 266 | +format that preserves your formulas, and then placed in the gfoX project |
|
| 267 | +directory of your private semester repository: |
|
| 268 | + |
|
| 269 | + 1. In Google Sheets, choose **File -> Download -> Microsoft Excel |
|
| 270 | + (.xlsx)**. Name/rename the downloaded file `gfoX.xlsx` |
|
| 271 | + (substituting the actual iteration, such as `gfo0.xlsx` or |
|
| 272 | + `gfo1.xlsx`). |
|
| 273 | + 2. Place the file in the corresponding project directory of your |
|
| 274 | + private semester repository (the same place you would put other |
|
| 275 | + project deliverables). |
|
| 276 | + 3. Add, commit, and push it. |
|
| 277 | + |
|
| 278 | +NOTE: do NOT download as CSV. CSV files contain only the displayed values |
|
| 279 | +and discard your formulas, which would defeat the purpose of the project. |
|
| 280 | + |
|
| 281 | +Be sure the push completes without errors, and verify that your file |
|
| 282 | +shows up in your repository. If not, check for typos and or locational |
|
| 283 | +mismatches (wrong directory, wrong filename, forgetting to push). |
|
| 284 | + |
|
| 285 | +Your submission is evaluated as of the project's due date, so be sure to |
|
| 286 | +push before the deadline (the late policy applies as usual). |
|
| 287 | + |
|
| 288 | +It is also a good idea to keep your Google Sheet itself as a backup. |
|
| 289 | + |
|
| 290 | +### RUBRIC |
|
| 291 | + |
|
| 292 | +What I will be looking for: |
|
| 293 | + |
|
| 294 | +``` |
|
| 295 | +52:gfoX:final tally of results (52/52) |
|
| 296 | +*:gfoX:gfoX.xlsx data points entered as numbers, adequately labelled [13/13] |
|
| 297 | +*:gfoX:gfoX.xlsx all calculations done as equations in spreadsheet [13/13] |
|
| 298 | +*:gfoX:gfoX.xlsx calculations reference cells, NOT literal data [13/13] |
|
| 299 | +*:gfoX:gfoX.xlsx calculations use available spreadsheet functions [13/13] |
|
| 300 | +``` |
|
| 301 | + |
|
| 302 | +Additionally: |
|
| 303 | + * Solutions not abiding by **SPIRIT** of project will be subject to a 25% overall deduction |
|
| 304 | + * Solution output lacking **ORGANIZATION** or not easy to read (fits on a standard screen without excessive scrolling, clear labels and formatting) are subject to a 25% overall deduction |
haas/fall2026/c4eng/projects/images/ptb0_circuit.jpg
| ... | ... | Binary files /dev/null and b/haas/fall2026/c4eng/projects/images/ptb0_circuit.jpg differ |
haas/fall2026/c4eng/projects/ptb0.md
| ... | ... | @@ -0,0 +1,223 @@ |
| 1 | +# ENGR1050 C for Engineers |
|
| 2 | + |
|
| 3 | +# PROJECT: Press The Button (PTB0) |
|
| 4 | + |
|
| 5 | +## OBJECTIVE |
|
| 6 | + |
|
| 7 | +Revisiting our LED binary counter (with expanded capacity) from stl2, |
|
| 8 | +this time with buttons to control the count (up/down by one). |
|
| 9 | + |
|
| 10 | +## PROCESS |
|
| 11 | + |
|
| 12 | +Do note, the productive way to go about this project involves taking the |
|
| 13 | +following steps: |
|
| 14 | + |
|
| 15 | + * starting early |
|
| 16 | + * reading the project page |
|
| 17 | + * asking questions regarding things you do not know, are not clear on, |
|
| 18 | + or are confused about |
|
| 19 | + * as information, concepts, processes become clear, that is something |
|
| 20 | + you can contribute to the project documentation (so you can better |
|
| 21 | + remember) |
|
| 22 | + |
|
| 23 | +If you start too late, and do not ask questions, and do not have enough |
|
| 24 | +time and don't know what is going on, you are not doing the project |
|
| 25 | +correctly. |
|
| 26 | + |
|
| 27 | +## OBTAIN THE PROJECT FILES |
|
| 28 | + |
|
| 29 | +To assist with consistency across all implementations, data files for use |
|
| 30 | +with this project are available on lab46 as a `grabit` Please copy the |
|
| 31 | +data to your private semester repository under an appropriate project |
|
| 32 | +directory to begin work. |
|
| 33 | + |
|
| 34 | +The project should be obtained by the **Sunday prior to the due date**. |
|
| 35 | + |
|
| 36 | +``` |
|
| 37 | +lab46:~/SEMESTER/c4eng$ grabit c4eng ptb0 |
|
| 38 | +``` |
|
| 39 | + |
|
| 40 | +Please study any provided code or supporting documents, and look up, |
|
| 41 | +experiment, and ask questions on aspects that you do not understand. |
|
| 42 | + |
|
| 43 | +## OPERATING THE PROJECT |
|
| 44 | + |
|
| 45 | +These projects will have two paths to them, depending on which device you |
|
| 46 | +are using: |
|
| 47 | + |
|
| 48 | + * Raspberry Pi single board computer (4/5) using the `wiringPi` library |
|
| 49 | + * Raspberry Pi Pico microcontroller |
|
| 50 | + |
|
| 51 | +``` |
|
| 52 | +lab46:~/SEMESTER/c4eng/ptb0$ make |
|
| 53 | +Please select which development environment: |
|
| 54 | + |
|
| 55 | + make wiringpi - using the Raspberry Pi with wiringpi library |
|
| 56 | + make pico - using the Raspberry Pi pico |
|
| 57 | + |
|
| 58 | +after which, you can use 'make' to build |
|
| 59 | +lab46:~/SEMESTER/c4eng/ptb0$ |
|
| 60 | +``` |
|
| 61 | + |
|
| 62 | +Run the `make` command with the category representing the path you will |
|
| 63 | +be working with for this project. |
|
| 64 | + |
|
| 65 | +After which, if you do an `ls`, you will see a cyan-colored file called |
|
| 66 | +`ptb0.c`. This is the C file you will be editing for this project. |
|
| 67 | + |
|
| 68 | +Go ahead and view it, study the code, eventually make any changes, save |
|
| 69 | +and return to the command-line. |
|
| 70 | + |
|
| 71 | +To build it, you simply run: `make` |
|
| 72 | + |
|
| 73 | +If there are no errors, it will build, and you proceed from there. |
|
| 74 | + |
|
| 75 | + |
|
| 76 | +## MAINTAINING YOUR REPOSITORY |
|
| 77 | + |
|
| 78 | +Be sure to keep your repository up-to-date, regularly committing changes |
|
| 79 | +to files. |
|
| 80 | + |
|
| 81 | +As a reminder, here are the suggested steps: |
|
| 82 | + |
|
| 83 | + -1. `make clean` <-- remove all unnecessary files |
|
| 84 | + 0. `git status` <-- see the current state of things |
|
| 85 | + 1. `git pull` <-- pull down any changes from elsewhere |
|
| 86 | + 2. `git add` <-- add each new or modified file |
|
| 87 | + 2a. `git add ./` <-- try this the first time |
|
| 88 | + 3. `git commit -m "your message"` <-- make a snapshot |
|
| 89 | + 4. `git push` |
|
| 90 | + |
|
| 91 | +## TASK |
|
| 92 | + |
|
| 93 | +Taking our knowledge of LEDs and buttons: |
|
| 94 | + |
|
| 95 | + * wire up the 10 element LED bar to individual wiringPi GPIOs (have |
|
| 96 | + 8-10 usable LEDs for the count) |
|
| 97 | + * wire up 2 buttons to individual wiringPi GPIOs |
|
| 98 | + * one button will be the **increment** button, increasing the value |
|
| 99 | + of the count by 1 |
|
| 100 | + * one button will be the **decrement** button, decreasing the value |
|
| 101 | + of the count by 1 |
|
| 102 | + * unless a button is pressed, the count remains on the current value |
|
| 103 | + * when the increment button is pressed, the count proceeds to count |
|
| 104 | + up by 1 |
|
| 105 | + * when the decrement button is pressed, the count proceeds to count |
|
| 106 | + down by 1 |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + |
|
| 110 | +The value of the count is to be displayed in binary on the LED bar. If |
|
| 111 | +"1" means the LED in that position is ON, and "0" means the LED in that |
|
| 112 | +position is OFF, then a count of 5 would appear as: |
|
| 113 | + |
|
| 114 | +``` |
|
| 115 | +0 0 0 0 0 0 0 1 0 1 |
|
| 116 | +``` |
|
| 117 | + |
|
| 118 | +Pressing the increment button would advance the display to: |
|
| 119 | + |
|
| 120 | +``` |
|
| 121 | +0 0 0 0 0 0 0 1 1 0 |
|
| 122 | +``` |
|
| 123 | + |
|
| 124 | +while pressing the decrement button would instead bring it back to: |
|
| 125 | + |
|
| 126 | +``` |
|
| 127 | +0 0 0 0 0 0 0 1 0 0 |
|
| 128 | +``` |
|
| 129 | + |
|
| 130 | +The LED circuits you will be constructing are the same ones we built in |
|
| 131 | +stl2: an LED circuit receiving power (from a GPIO pin), having a 220 Ohm |
|
| 132 | +resistor, an LED, and then connecting to ground, using the 10 segment LED |
|
| 133 | +bar (ten individual LEDs packaged into one component). Remember you still |
|
| 134 | +need to hook up resistors to each LED. |
|
| 135 | + |
|
| 136 | +Each LED circuit will be powered from a unique GPIO pin, allowing for |
|
| 137 | +conditional supply of power, based on our code. Likewise, each button |
|
| 138 | +will be connected to its own unique GPIO pin, which your program will |
|
| 139 | +read to determine whether that button is currently being pressed. |
|
| 140 | + |
|
| 141 | +As in stl2, you will use a **loop** where your use of **if** statements |
|
| 142 | +has been optimized so you're not writing a case for each possible state, |
|
| 143 | +but instead bit positions / place values. Consider also what should |
|
| 144 | +happen at the edges of your count (such as decrementing below zero, or |
|
| 145 | +incrementing past the largest value your LEDs can show), and document |
|
| 146 | +your decision in your comments. |
|
| 147 | + |
|
| 148 | +## EXECUTION |
|
| 149 | + |
|
| 150 | +If on the pico, follow the process for downloading the binary file and |
|
| 151 | +programming your pico. |
|
| 152 | + |
|
| 153 | +If on the full Raspberry Pi, you have a green executable you can run just |
|
| 154 | +as we've done in our other projects. |
|
| 155 | + |
|
| 156 | +## STRATEGY |
|
| 157 | + |
|
| 158 | +The general flow of the process (one way of going about it, anyway) can |
|
| 159 | +be described as follows: |
|
| 160 | + |
|
| 161 | +``` |
|
| 162 | +SET COUNT TO ZERO |
|
| 163 | +REPEAT INFINITELY: |
|
| 164 | + SHOULD THE INCREMENT BUTTON BE PRESSED: |
|
| 165 | + INCREMENT COUNT BY ONE |
|
| 166 | + |
|
| 167 | + SHOULD THE DECREMENT BUTTON BE PRESSED: |
|
| 168 | + DECREMENT COUNT BY ONE |
|
| 169 | + |
|
| 170 | + BIT POSITION IS ONE |
|
| 171 | + LED OFFSET IS ZERO |
|
| 172 | + REPEAT AS LONG AS LED OFFSET IS LESS THAN TEN: |
|
| 173 | + SHOULD THE CURRENT BIT POSITION HAVE A ONE: |
|
| 174 | + ACTIVATE THE LED AT CURRENT OFFSET |
|
| 175 | + OTHERWISE: |
|
| 176 | + DEACTIVATE THE LED AT CURRENT OFFSET |
|
| 177 | + |
|
| 178 | + LEFT SHIFT BIT POSITION BY ONE |
|
| 179 | + LED OFFSET IS INCREMENTED BY ONE |
|
| 180 | + |
|
| 181 | + DELAY AT LEAST FIFTY MILLISECONDS |
|
| 182 | + |
|
| 183 | +REPEAT BLOCK |
|
| 184 | +``` |
|
| 185 | + |
|
| 186 | +## SUBMISSION |
|
| 187 | + |
|
| 188 | +To successfully complete this project, the following criteria must be |
|
| 189 | +met: |
|
| 190 | + |
|
| 191 | + * Code must compile/execute cleanly (no notes, warnings, nor errors) |
|
| 192 | + * Code must be nicely and consistently indented |
|
| 193 | + * Code must be well commented |
|
| 194 | + * Do NOT double space your code. Group like statements together. |
|
| 195 | + * Track/version the source code in your private semester repository |
|
| 196 | + |
|
| 197 | +To submit this project to me, make sure the `Makefile` and your completed |
|
| 198 | +`ptb0.c` file are placed in your private semester repository under |
|
| 199 | +`c4eng/ptb0/` |
|
| 200 | + |
|
| 201 | +What I'll be looking for: |
|
| 202 | + |
|
| 203 | +### RUBRIC |
|
| 204 | + |
|
| 205 | +I'll be evaluating the project based on the following criteria: |
|
| 206 | + |
|
| 207 | +``` |
|
| 208 | +208:ptb0:final tally of results (208/208) |
|
| 209 | +*:ptb0:used grabit to obtain project by the Sunday prior to duedate [13/13] |
|
| 210 | +*:ptb0:clean compile, no compiler messages [13/13] |
|
| 211 | +*:ptb0:post a picture or short video to the DISCORD [26/26] |
|
| 212 | +*:ptb0:each LED hooked to a unique GPIO [26/26] |
|
| 213 | +*:ptb0:each button hooked to unique GPIOs [52/52] |
|
| 214 | +*:ptb0:button state is read, on press code adjusts count [52/52] |
|
| 215 | +*:ptb0:binary value of the count correctly displayed on LED bar [13/13] |
|
| 216 | +*:ptb0:code tracked in lab46 semester repo [13/13] |
|
| 217 | +``` |
|
| 218 | + |
|
| 219 | +Additionally: |
|
| 220 | + * Solutions not abiding by spirit of project will be subject to a 50% overall deduction |
|
| 221 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 222 | + * Solutions not utilizing indentation to promote scope and clarity or otherwise maintaining consistency in code style and presentation will be subject to a 25% overall deduction |
|
| 223 | + * Solutions not organized and easy to read (assume a terminal at least 90 characters wide, 40 characters tall) are subject to a 25% overall deduction |
haas/fall2026/unix/projects/upf1.md
| ... | ... | @@ -0,0 +1,273 @@ |
| 1 | +# CSCS1730 UNIX/Linux Fundamentals |
|
| 2 | + |
|
| 3 | +# PROJECT: UNIX PIPE FUN (upf1) |
|
| 4 | + |
|
| 5 | +## ERRATA |
|
| 6 | + |
|
| 7 | + * revision #: <description> (DATESTAMP) |
|
| 8 | + |
|
| 9 | +## OBJECTIVE |
|
| 10 | + |
|
| 11 | +To continue to cultivate your problem solving skills, to practice your |
|
| 12 | +shell skills, and to demonstrate your basic scripting skills. |
|
| 13 | + |
|
| 14 | +## BACKGROUND |
|
| 15 | + |
|
| 16 | +Pipes and command expansions are important concepts and skills that you |
|
| 17 | +need to be familiar with as we proceed down the shell scripting rabbit |
|
| 18 | +hole. |
|
| 19 | + |
|
| 20 | +This project has us playing with various examples that will require |
|
| 21 | +regular use of these skills, for the purpose of converting units. |
|
| 22 | + |
|
| 23 | +## GET STARTED |
|
| 24 | + |
|
| 25 | +This week's project has 2 points of origin. |
|
| 26 | + |
|
| 27 | +First, in the **upf1/** sub-directory of the UNIX Public Directory, |
|
| 28 | +under a directory by the name of your username, you will find the |
|
| 29 | +following file: |
|
| 30 | + |
|
| 31 | + * **TASK** |
|
| 32 | + |
|
| 33 | +Copy this file into your project directory. |
|
| 34 | + |
|
| 35 | +The **TASK** file will contain the particular units to start with and |
|
| 36 | +convert to. |
|
| 37 | + |
|
| 38 | +Next, you will want to grab the latest version of the **unittools** |
|
| 39 | +suite from the following URL: |
|
| 40 | + |
|
| 41 | + * https://lab46.g7n.org/~wedge/projects/unittools/ |
|
| 42 | + |
|
| 43 | +You will want to use a tool like **wget(1)** or **curl(1)** to |
|
| 44 | +non-interactively download it onto your lab46 account, and similarly |
|
| 45 | +extract, compile, and install that (check its own README file). |
|
| 46 | + |
|
| 47 | +There may be multiple versions of **unittools** available at the |
|
| 48 | +download link. Unless you have specific reason otherwise (for this |
|
| 49 | +project, you do not), you want to go for the latest version, which will |
|
| 50 | +be reflected by the most recent datestamp encoded in the file's name. |
|
| 51 | + |
|
| 52 | +For example, say you have the following: |
|
| 53 | + |
|
| 54 | + * unittools-20160731-10.tar.gz |
|
| 55 | + * unittools-20161024-14.tar.gz |
|
| 56 | + * unittools-20170123-13.tar.gz |
|
| 57 | + * unittools-20170201-09.tar.gz |
|
| 58 | + |
|
| 59 | +From visual inspection, you would select the "20170201-09" one, because |
|
| 60 | +the date it encodes (Feb 1st, 2017 at 9am) is the most recent in that |
|
| 61 | +group. You will find this to be a common practice with many software |
|
| 62 | +projects on the internet. |
|
| 63 | + |
|
| 64 | +Note, however, that visual inspection alone is not good enough for your |
|
| 65 | +steps file. New versions may be released, and your steps file needs to |
|
| 66 | +obtain the most recent version available. To facilitate this task, the |
|
| 67 | +latest and greatest version of unittools will be listed in a file called |
|
| 68 | +**LATEST** (which you should see near the top of the directory index |
|
| 69 | +listing). You can make use of this file to assist you in automating the |
|
| 70 | +process of determining and downloading the latest version of the |
|
| 71 | +unittools tools. |
|
| 72 | + |
|
| 73 | +Once those two steps are complete, you can begin on the tasks listed in |
|
| 74 | +your **TASK** file. |
|
| 75 | + |
|
| 76 | +### UNITTOOLS SUITE |
|
| 77 | + |
|
| 78 | +The unittools suite is a collection of command-line tools that perform |
|
| 79 | +various unit conversions you may find useful for this project. The tools |
|
| 80 | +include: |
|
| 81 | + |
|
| 82 | + * **cm2in** - convert centimeters to inches |
|
| 83 | + * **cu2mm** - convert cubits to millimeters |
|
| 84 | + * **dm2cm** - convert decimeters to centimeters |
|
| 85 | + * **Dm2mi** - convert Decameters to miles |
|
| 86 | + * **ft2hm** - convert feet to hectometers |
|
| 87 | + * **ft2yd** - convert feet to yards |
|
| 88 | + * **hm2dm** - convert hectometers to decimeters |
|
| 89 | + * **hm2Dm** - convert hectometers to Decameters (if not available, |
|
| 90 | + use **hm2dcm** instead) |
|
| 91 | + * **in2cu** - convert inches to cubits |
|
| 92 | + * **in2ft** - convert inches to feet |
|
| 93 | + * **km2ft** - convert kilometers to feet |
|
| 94 | + * **mi2km** - convert miles to kilometers |
|
| 95 | + * **mi2yd** - convert miles to yards |
|
| 96 | + * **mm2dm** - convert millimeters to decimeters |
|
| 97 | + * **st2mi** - convert stadions to miles |
|
| 98 | + * **yd2mi** - convert yards to miles |
|
| 99 | + * **yd2st** - convert yards to stadions |
|
| 100 | + |
|
| 101 | +The tools by default expect input via STDIN, and will output to STDOUT. |
|
| 102 | + |
|
| 103 | +These tools have command-line arguments which can alter their default |
|
| 104 | +behavior. You may want to review the options and defaults (try running |
|
| 105 | +them with the **-h** argument to see what sort of functionality is |
|
| 106 | +available). |
|
| 107 | + |
|
| 108 | +## PROCESS |
|
| 109 | + |
|
| 110 | +In the **TASK** file, you will be given a set of source quantities/units |
|
| 111 | +and destination units you need to construct command-lines for to solve, |
|
| 112 | +using the tools provided to you in the **unittools** suite. You will |
|
| 113 | +also want to make use of pipes and command expansions in your solutions. |
|
| 114 | + |
|
| 115 | +As an example, take the following (formatted as it would appear in your |
|
| 116 | +**TASK** file): |
|
| 117 | + |
|
| 118 | +``` |
|
| 119 | +task: 0 |
|
| 120 | +precision: 3 |
|
| 121 | +input_value: 35 |
|
| 122 | +input_unit: cm |
|
| 123 | +output_unit: ft |
|
| 124 | +chain_delim: " >> " |
|
| 125 | +``` |
|
| 126 | + |
|
| 127 | +With these in mind, we can set about solving this problem, using the |
|
| 128 | +tools in combination to arrive at the desired result. |
|
| 129 | + |
|
| 130 | +A potential solution would be as follows: |
|
| 131 | + |
|
| 132 | +``` |
|
| 133 | +lab46:~/src/SEMESTER/unix/upf1$ echo "35" | cm2in |
|
| 134 | +13.78 in |
|
| 135 | +lab46:~/src/SEMESTER/unix/upf1$ echo "13.78" | in2ft |
|
| 136 | +1.15 ft |
|
| 137 | +lab46:~/src/SEMESTER/unix/upf1$ |
|
| 138 | +``` |
|
| 139 | + |
|
| 140 | +But that's not very optimized. We could instead do something better, |
|
| 141 | +like: |
|
| 142 | + |
|
| 143 | +``` |
|
| 144 | +lab46:~/src/SEMESTER/unix/upf1$ echo "35.000 cm" | cm2in OPTIONS | in2ft OPTIONS |
|
| 145 | +35.000 cm >> 13.780 in >> 1.148 ft |
|
| 146 | +lab46:~/src/SEMESTER/unix/upf1$ |
|
| 147 | +``` |
|
| 148 | + |
|
| 149 | +Note that with **precision**, you need to instruct the tools to display |
|
| 150 | +out to the specified number of decimal places. |
|
| 151 | + |
|
| 152 | +We'll want to record our command-lines in the appropriate place. Since |
|
| 153 | +this is task #0, we'll want to record it in a file called: |
|
| 154 | +**task0.cli**, which should basically just contain the command-lines you |
|
| 155 | +ran, merely placed in a text file. |
|
| 156 | + |
|
| 157 | +For final output, we'll want to display the chain of conversions we went |
|
| 158 | +through. So, for the above example: |
|
| 159 | + |
|
| 160 | +``` |
|
| 161 | +lab46:~/src/SEMESTER/unix/upf1$ ./task0.cli |
|
| 162 | +35.000cm >> 13.780in >> 1.148ft |
|
| 163 | +lab46:~/src/SEMESTER/unix/upf1$ |
|
| 164 | +``` |
|
| 165 | + |
|
| 166 | +Basically, each task#.cli will be its own script. If we were to execute |
|
| 167 | +it, the correct result should be produced. |
|
| 168 | + |
|
| 169 | +## UPF1STEPS |
|
| 170 | + |
|
| 171 | +You will once again be creating a steps file that can automate your |
|
| 172 | +project (ie it contains a list of non-interactive steps to complete the |
|
| 173 | +task). |
|
| 174 | + |
|
| 175 | +As in previous projects, **upf1steps** will contain the steps you took |
|
| 176 | +from the point of creating your project directory, copying the **TASK** |
|
| 177 | +file, and downloading the unittools suite, up until the submit step |
|
| 178 | +(hint: just run the task#.cli scripts within the steps script). |
|
| 179 | + |
|
| 180 | +To clarify: YES, I want to see steps creating a project directory, |
|
| 181 | +copying and downloading files in question, extracting, compiling, |
|
| 182 | +installing, and then of course running each individual task#.cli script. |
|
| 183 | + |
|
| 184 | +There are some additional constraints you need to keep in mind: |
|
| 185 | + |
|
| 186 | + * your script should not produce ANY STDERR output |
|
| 187 | + * your script should ONLY produce STDOUT output in conformance with the |
|
| 188 | + below stated requirements. Any other output needs to be silenced. |
|
| 189 | + * You will want one unified command-line producing the end result, not |
|
| 190 | + separate one-step transitions. The idea is to utilize pipes. |
|
| 191 | + * semi-colons used to separate commands do not constitute one |
|
| 192 | + command-line, but several. |
|
| 193 | + * For each task, you'll want to display things as follows: |
|
| 194 | + * "Task X conversion chain: CHAIN" |
|
| 195 | + * where X is the task number (0, 1, 2, etc.) |
|
| 196 | + * where CHAIN is the conversion chain output matching the TASK file |
|
| 197 | + result requested (ie, you must run your task#.cli script to |
|
| 198 | + produce this output). |
|
| 199 | + * note that the task#.cli output appears on the SAME line as the |
|
| 200 | + "Task X conversion chain:" text, and there is a single space |
|
| 201 | + separating it from the colon. |
|
| 202 | + * there is NO space between value and unit |
|
| 203 | + |
|
| 204 | +For example, a sample output of your **upf1steps** script should appear |
|
| 205 | +as follows (but your # values will of course be different based on your |
|
| 206 | +individual **TASK** file): |
|
| 207 | + |
|
| 208 | +``` |
|
| 209 | +lab46:~/src/SEMESTER/unix/upf1$ ./upf1steps |
|
| 210 | +Task 0 conversion chain: 35.000cm >> 13.780in >> 1.148ft |
|
| 211 | +... |
|
| 212 | +lab46:~/src/SEMESTER/unix/upf1$ |
|
| 213 | +``` |
|
| 214 | + |
|
| 215 | +## SUBMISSION |
|
| 216 | + |
|
| 217 | +By successfully performing this project, you should have a set of |
|
| 218 | +`task#.cli` files (one for each task). You will want to submit these, |
|
| 219 | +along with a **upf1steps** file. |
|
| 220 | + |
|
| 221 | +### SUBMIT TOOL USAGE |
|
| 222 | + |
|
| 223 | +To submit this project to me using the **submit** tool, run the |
|
| 224 | +following command at your lab46 prompt: |
|
| 225 | + |
|
| 226 | +``` |
|
| 227 | +$ submit unix upf1 upf1steps task*.cli |
|
| 228 | +Submitting unix project "upf1": |
|
| 229 | + -> upf1steps(OK) |
|
| 230 | + -> task0.cli(OK) |
|
| 231 | + -> task1.cli(OK) |
|
| 232 | + -> task2.cli(OK) |
|
| 233 | + -> task3.cli(OK) |
|
| 234 | + ... |
|
| 235 | + |
|
| 236 | +SUCCESSFULLY SUBMITTED |
|
| 237 | +``` |
|
| 238 | + |
|
| 239 | +You should get some sort of confirmation indicating successful |
|
| 240 | +submission if all went according to plan. If not, check for typos and or |
|
| 241 | +locational mismatches. |
|
| 242 | + |
|
| 243 | +### RUBRIC |
|
| 244 | + |
|
| 245 | +I'll be looking for the following: |
|
| 246 | + |
|
| 247 | +``` |
|
| 248 | +234:upf1:final tally of results (234/234) |
|
| 249 | +*:upf1:upf1steps has valid list of non-interactive instructions [13/13] |
|
| 250 | +*:upf1:upf1steps only modifies files if USER matches [13/13] |
|
| 251 | +*:upf1:upf1steps builds the various task#.cli files it runs [13/13] |
|
| 252 | +*:upf1:upf1steps obtains the latest unittools release from site [13/13] |
|
| 253 | +*:upf1:upf1steps only displays specified STDOUT output [13/13] |
|
| 254 | +*:upf1:upf1steps errorlessly creates local project directory [13/13] |
|
| 255 | +*:upf1:upf1steps makes clear, effective use of wildcards [13/13] |
|
| 256 | +*:upf1:upf1steps defines and uses custom variables [13/13] |
|
| 257 | +*:upf1:upf1steps uses command expansions to get information [13/13] |
|
| 258 | +*:upf1:upf1steps uses a loop to drive numbers in final output [13/13] |
|
| 259 | +*:upf1:upf1steps automates the task when run [13/13] |
|
| 260 | +*:upf1:all files are organized, clear, and easy to read [13/13] |
|
| 261 | +*:upf1:task#.cli files output using specified precision [13/13] |
|
| 262 | +*:upf1:task#.cli files output using specified delimiter [13/13] |
|
| 263 | +*:upf1:task#.cli files output only correct value and unit, in format [13/13] |
|
| 264 | +*:upf1:task#.cli files display no STDERR output [13/13] |
|
| 265 | +*:upf1:task#.cli files have solution within given constraints [13/13] |
|
| 266 | +*:upf1:task#.cli files only contain the solution command-line [13/13] |
|
| 267 | +``` |
|
| 268 | + |
|
| 269 | +Additionally: |
|
| 270 | + * Solutions not abiding by spirit of project will be subject to a 25% overall deduction |
|
| 271 | + * Solutions not utilizing descriptive why and how comments will be subject to a 25% overall deduction |
|
| 272 | + * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction |
|
| 273 | + * Solutions not organized and easy to read (within 90 char width) are subject to a 25% overall deduction |