User Tools

Site Tools


user:jparrish:start

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
user:jparrish:start [2023/12/15 04:04] – [SECTION 2: WRITING C CODE] jparrishuser:jparrish:start [2023/12/15 04:40] (current) jparrish
Line 29: Line 29:
        *hg pull - pulls the files pushed into the repository         *hg pull - pulls the files pushed into the repository 
        *hg update - updates the systems current repository to match the one pulled        *hg update - updates the systems current repository to match the one pulled
 +to turn in a project, you must first push it to lab46, then within lab46, run the submit command.
 ==== SECTION 2: WRITING C CODE ==== ==== SECTION 2: WRITING C CODE ====
 In this section, we will be going over the basics of writing, troubleshooting, and compiling C code, aswell as basic functions and basic programs that are either useful, or a good refresher. \\ In this section, we will be going over the basics of writing, troubleshooting, and compiling C code, aswell as basic functions and basic programs that are either useful, or a good refresher. \\
Line 92: Line 93:
 ^xor|returns 0 if both bits are opposite| ^xor|returns 0 if both bits are opposite|
  
 +we can also create our own functions aswell if needed. to do that, we just need to do\\
 +<code>  int NAME(int VARIABLE1, int VARIABLE2, ... , int VARIABLEN){
 +int RESULT = 0;
 +RESULT = whatever you want code to do;
 +return(result); </code>
 +a library essentially is full of this, which allows us to use functions not in the c language natively. \\
 +the last important note is different data types, which are important to know as each have a max size, they are as follows \\
 +Signed char-  occupies 1 byte of memory or 8 bits, or numbers from -128 to 127. \\
  
 +Unsigned char- same as signed char, but no negatives, 0 to 255 \\
 +Signed short int- occupies 2 bytes of memory, or numbers from -32,768 to 32,767.\\
  
 +Unsigned short int-same as signed short int, with no negatives, 0 to 65,535.\\
 +
 +Signed int-  occupies 4 bytes of memory, or numbers from -2,147,483,648 to 2,147,483,647 \\
 +
 +Unsigned int- same as signed, but no negatives, 0 to 4,294,967,295.\\
 +
 +Signed long int- occupies 8 bytes of memory, from -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807. \\
 +
 +Unsigned long int- same as signed long int, but no negatives, from 0 to 18,446,744,073,709,551,616 .\\
 +
 +Signed long long int-  occupies 8 bytes of memory, max/min is +-18,446,744,073,709,551,615 \\
 +Unsigned long long int-  occupies 8 bytes of memory, max is 18,446,744,073,709,551,615 \\
 +\\
 ==== SECTION 3: HARDWARE AND WIRINGPI ==== ==== SECTION 3: HARDWARE AND WIRINGPI ====
-==== SECTION 4PUZZLES ====+Hardware is the most used part of this class, where we typically use LEDS and Wiring pi.\\ 
 +with wiring pi installed by doing \\ 
 +<code>wget https://project-downloads.drogon.net/wiringpi-latest.deb 
 +then 
 +sudo dpkg -i wiringpi-latest.deb </code> 
 +with wiring pi now installed, we can do some basic things\\ 
 +typing gpio readall into the terminal will spit back the state of all the pins on the gpio board \\ 
 +{{ :user:jparrish:screenshot_2023-12-14_232119.png?direct&400 |}} 
 +typing gpio write (wpi number) 1 will change the state of the selected pin to 1 or HIGH, type 0 for LOW \\ 
 +gpio mode (wpi number) out will change the pin to output mode, typing in instead will put it into input mode\\ 
 +for any project, youll need the wiringPi library included in your code to make use of wiringPi\\ 
 +\\ 
 +\\ 
 +Within your code, you can use digitalWrite and digitalRead to change the state or read the state of a pin, which is useful for turning an led on and off or checking to see if a button is pressed\\ 
 +<code> digitalWrite (pin,HIGH or LOW) 
 +digitalRead(pin) 
 +</code> 
 +if we include softPwm into our libraries, we can also change how much voltage is sent through the pin, instead of High or Low 
 +<code> softPwmCreate(pin,min,max) 
 +softpwmWrite(pin, level) 
 +</code> 
 +this is useful to make an led breathe or to get different colors in an RGB led\\ 
 +for components, there are far to many to list and explain how they must be wired, instead, one can refer to the wiringPi spreadsheet, which gives basic examples, and wiring for each component\\ 
 +[[https://github.com/Freenove/Freenove_Ultimate_Starter_Kit_for_Raspberry_Pi/archive/master.zip|Zip file with pdf, and more]] 
 ==== SECTION 5: SPREADSHEETS AND TEXT BASED TASKS ==== ==== SECTION 5: SPREADSHEETS AND TEXT BASED TASKS ====
 +This section will show how to install the spreadsheet program and basic functions\\
 +firstly, install sc by runnning 
 +<code> sudo aptitude install sc </code>
 +once sc is installed, you can open files by doing sc (filename)\\
 +within sc, there are tons of functions and commands that can be looked upin the terminal with <code> man sc </code>
 +But, for the purposes we are using it for, there are only a handful that you should really know \\
 +|Q | quit the program |
 +|= | enter a number that you can use for cell calculation (D4 - D5) |
 +|/<,> | enter a string center aligned ,left, or right aligned |
 +|@sum| add all in specified range |
 +within the course, sc is mainly used for gfo.\\
 +
 +
  
-==== CLOSING NOTES ==== 
  
  
user/jparrish/start.1702613098.txt.gz · Last modified: 2023/12/15 04:04 by jparrish