User Tools

Site Tools


user:nbutler5:start

EOCE PROJECT 0x0 - EXPLANATION OF EVERY PROJECT/PROJECT GENRE


PCTX -

PRACTICING CRITICAL THINKING projects were weekly projects, but required bi-weekly the others were bonus points.

The objective of the project was to use logic and reasoning to get answers, which is critical to becoming a good coder. The logic puzzles were long division of letters with specific bases (10, 11, 12, etc.) and with the knowledge of calculating a quotient with real number we translate that to the letter long division, but add logic to accomplish the puzzle. Base 10 are values 0,1,2,3,4,5,6,7,8,9 and each numerical value would be associated with a letter at the end of the puzzle once you've solved it.

Puzzle ex:

            GLJK
      +---------
 KJKK | GLMBRVLR
       -VKOKL
        =====
         LJBGV
        -OKVKG
         =====
          JJGKL
         -LKBKV
          =====
           KVRMR
          -JKRKB
           =====
            VKMK
            
letters: BGJKLMOPRV

How you would organize yourself while doing the puzzle:

B = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
G = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
J = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
K = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
L = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
M = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
O = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
P = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
R = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }
V = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }

GFOX -

SPREADSHEET CALCULATOR (sc)

For all gfoX's the object was to calculate your grade at a specific time throughout the semester as to get a good idea on what you need to work on if anything. I used all of the basic functions below, and I used the exact template from the project page, and added on every next gfo project.

To start the program, just type “sc.” The initial screen is a blank sheet which is lined across the top and down the side with the familiar spreadsheet number scheme, i.e. letters across the top and numbers down the side.



= Enter a numeric constant or expression into the current cell. sc prompts for the expression on the top line.

Enter a label string into the current cell to be flushed left against the left edge of the cell.

Enter a label string into the current cell to be centered in the column.

Enter a label string into the current cell to be flushed right against the right edge of the cell.

There is a way to change the way values are entered. Called the “quick numeric entry mode,” you need to start sc with the “-n” option, or type CTRL + T and then “n” in the program. In this mode, as soon as you start typing a number, the prompt will appear. What this means is that you can skip typing “=”.

Equations are entered in the same way as in a regular spreadsheet. Type “=” followed by the equation, e.g. “=B0+B1+B2+B3”

The built-in functions operate a little different than those in other spreadsheets in that they start with @, so to get the sum of a range you need to use @sum (range), where “range” is the start, and end cell names separated by a colon, e.g. @sum (B2:B4)

@avg() - Average all valid (nonblank) entries in the specified region (blank cells won't affect functionality i.e. no need to put in 0 for blank cells when applying a function to a range).

@max() - Return the maximum value in the specified region.

@min() - Return the minimum value in the specified region.

@sqrt() - Return the square root of e.

@max() - Return the maximum of the values of the expressions. Two or more expressions may be specified.

@min() - Return the minimum of the values of the expressions. Two or more expressions may be specified


ABC0 -

abc0 was testing to see how you can handle unfamiliarity. This is the first code you write in the class, and is the classic beginner program of “hello world”. This program taught you the basic look/construction of code, and a main function used in many programs printf. This function allows you to display anything you want onto the terminal as long as its with the quotation marks“”. the #include states what clibraries you want libraries give you access to specific functions. \n after Hello World just makes the Hello World display below the “terminal line” (file route plus the name of you computer).

#include <stdio.h> 

int main(void)
{
	printf("Hello World\n"); 
	return 0; 
}

GTF0 -

The Graphics To Figure-out project was a project to create a piece of art with certain criteria, an example of a requirement is at least 8 unique colors must be used.

C color recipe: The colors you have to work with are red, green, and blue. With these colors you can create an infinite number of different colors using the 3 set colors and changing the ratio's between the three. You can screw around with the values within the constrained values (A-F & 0-9). Luckily you don't have to that, because google spits out the hex# for you to work with. Simply look up “color picker” in google and choose the color you desire and record the provided hex#.

Ex:) Dark-ish red, hex# = #7d3838, which translates to red (0x7D), green (0x38), blue (0x38) so you can look at the hex# as 7d-38-38, and plug the three pairs of numbers into the “equation” 0x00, maintaining the “0x” and substituting in the “00” with the respective value pair.

colors can be generated as such: orange = gdImageColorAllocate (image, 0x00, 0x00, 0x00);

The other side of this project is to generate shapes and tie the colors you have made to the shapes. The shapes you can create can be made with functions from the library gd.h.

link for functions: https://libgd.github.io/manuals/2.3.0/index/Functions.html


DTR0 -

Data Type Resources was a project to demonstrate data types in C, while also introducing us to binary and hexadecimal values. Data type is an attribute associated with a piece of data that tells a computer system how to interpret its value. Understanding data types ensures that data is collected in the preferred format and the value of each property is as expected.

signed - values that can be negative

unsigned - values that can only be positive

signed char: -128 to 127, total 256

unsigned char: 0 to 255, total 256

signed short int: -32768 to 32767, total 65536

unsigned short int: 0 to 65535, total 65536

signed int: -2147483648 to 2147483647, total 4294967296

unsigned int: 0 to 4294967295, total 4294967296

signed long int: -9223372036854775808 to 9223372036854775807, total 18446744073709551616

unsigned long int: 0 to 18446744073709551615, total 18446744073709551616

signed long long int: -9223372036854775808 to 9223372036854775807, total 18446744073709551616

unsigned long long int: 0 to 18446744073709551615, total 18446744073709551616


STLX -

STL0: Blink LED light every 1 second

This is the first project where we get familiar with the wiring of the cobbler on the breadboard of the electronics kit and how to understand the cobbler to implement code properly. You also have to use the wiringPi.h library to use all of the Pi functions, and to initialize the functionality of the wiringPi library you must have a if statement in your code for the wiringPiSetup function.

After this you have to choose which pins you'd like to use for you circuit and then translate the desired pins into the code for all of the components being used as well as to set the pins to output.

For STL0 the main operation in the code is a simple infinite loop while statement that uses the digitalWrite function to set the pin to low or high, indicating on or off and then a delay of (BLANK) milliseconds for the time blinking requirement. the delay says how long between the on and off cycle to wait.

STL1: Using 4 LED's count to from 0 (0000) to 15 (1111) using binary

STL1

The second STL project has you make a sequence of lights that turn on and off according to the binary value so the first sequence in the code or zero or in binary 0000 all lights are off because 0 indicates off and 1 indicates on. Which also means that the last number in the sequence before it starts over again is 15 and all 4 LED's are on because the binary value of 15 is 1111. The image of the circuit above can be adopted for STL1, just multiple everything by 4.

(0000) = (4th place, 3rd place, 2nd place, 1st place)


0 0 0 0 (0) - ZERO LIGHTS ON
0 0 0 1 (1) - 1ST LIGHT ON
0 0 1 0 (2) - 2nd LIGHT ON
0 0 1 1 (3) - 1st AND 2nd LIGHTS ON
0 1 0 0 (4) - 3rd LIGHT ON
0 1 0 1 (5) - 3rd AND 1st LIGHTS ON
0 1 1 0 (6) - 3rd and 2nd LIGHTS ON
0 1 1 1 (7) - 3rd, 2nd and 1st LIGHTS ON
1 0 0 0 (8) - 4th LIGHT ON
1 0 0 1 (9) - 4th and 1st LIGHTS ON
1 0 1 0 (10)- 4th and 2nd LIGHTS ON
1 0 1 1 (11)- 4th, 2nd and 1st LIGHTS ON
1 1 0 0 (12)- 4th and 3rd LIGHTS ON
1 1 0 1 (13)- 4th,3rd and 1st LIGHTS ON
1 1 1 0 (14)- 4th,3rd and 2nd LIGHTS ON
1 1 1 1 (15)- 4th,3rd,2nd and 1st LIGHTS ON
  
ROLLS OVER TO ZERO AND STARTS OVER AGAIN
(infinite loop)

PTBX -

The first PTB project was to turn on and off a passive speaker, and also attach an indicator to show that the speaker is no or off (other than the sound that the speaker would make). The specific indicator was LED lights. RED LED on meant the speaker is off, and a GREEN LED on meant the speaker is on.

The second PTB project was to use the 10 element LED bar to count to 10, but adding a light for each value so instead of saying 2 is a light turned on in the 2's place, have two lights on sequentially stating the value 2.

The third and final PTB project was to use the multi-colored LED light that can display red, green, and blue light. The objective was to use three buttons, and preferably “label” them with there respective color caps to indicate when the blue capped button is depressed the a blue light will appear from the multi-colored LED.


EAPX -

EAPX 1-3 was an evolution of a project starting with the base program and adding features, then finally optimizing the code.

For the first evolution of the project was to use the stock code from freenove electronics kit tutorial page for the LCD module. Once I copied the code then I just cleaned it up and commented it so that I could understand it as well as make it more readable. The readability aspect was critical, because the stock code was lazily written and whoever wrote it wasn't very disciplined about the readability.

The second evolution of the project was to add a feature to the stock code. I added a blinking LED for whenever the LCD module updates its information, the information that was being updated was the CPU temperature of the Pi.

The third evolution of the project was to optimize the code. I implemented a statement in the terminal readout when the code was running indicating CTRL-C should be used to stop the program, as well as using more rigorous if statements for the wiringPiSetup function, and then cleaned up the code even more.


LINUX/TERMINAL COMMANDS -

ls - list of files within folder.

jewc - this command is used to see your status for work count for your weekly journal.

[submitting files sequence] hg status - ( sanitizehg potentially) - (hg merge potentially) - hg add - hg commit m-“message” - hg push - hg log.

[pulling files for repository] hg status - hg pull - hg update - hg log.

exit - this command can be used to get out of lab46 shell, then write the command again and it closes the terminal.

touch filename.txt - this creates a text file and then to edit the file just nano into the txt file.

cat - View file without the ability to edit it(This shows up in the terminal).

nano - edit the files within the nano window (note you CANNOT use your mouse in nano only arrow keys).

cd - change to location (Ex: cd fall2023) this tells the terminal you'd like to go to the next folder in the “sequence”.

[using cd with nothing] cd - brings you back to the home folder.

cd .. - This brings you back to the previous folder you were in.

rm - this command is for removing files.

rmdir - this command is used for removing folders/directory's.

mkdir - this command is used to make folders/directory's.

cp - this command copy's files/folder and can later be used with another command to moved whatever you copied into another location.

mv - this is the command to move a folder/file to another location, you must type out the destination so for instance mv (file) /fall2023/c4eng/abc0.

grabit - grabs a file/folder you'd like to place somewhere and “cuts it” from the location where you grabbed it from.

submit - This command submits files to a location of your desire, not you have to be in the folder where the file is to send it to a different location.

make submit - This can be used is and only if you have the Makefile in the directory you want to submit.

status x - This tells you the status of numerous applications like the submitting files (status c4eng) or hg status to see what needs to be pushed to the repository.

history - This command will display on the terminal all the commands you performed, I find this helpful now, maybe not in the future, but it really helps to look back at what you did in case you forgot. The history only displays the commands used not the location (folder) where they were used. That would've been nice, but for now that's ok.


PCTURES FOR EoCE 0x3


user/nbutler5/start.txt · Last modified: 2023/12/14 22:27 by nbutler5