User Tools

Site Tools


haas:fall2020:common:projects:led0

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
haas:fall2020:common:projects:led0 [2020/08/25 12:49] – [Testing connectivity] wedgehaas:fall2020:common:projects:led0 [2020/09/18 09:28] (current) – [The Circuit to Construct] wedge
Line 3: Line 3:
  
 =====Objective===== =====Objective=====
-To create a program that generates a unique pattern of lit LEDs on your pi based on constraints+To successfully interface an LED to your pi and control it via software (commands, provided program)
  
-{{page>haas:fall2020:common:projects:abstract}}+We also further utilize enforced time constraints, tying project credit to your starting on the project before the deadline (so be sure to plan accordingly!) 
 + 
 +=====Abstraction===== 
 +{{page>haas:fall2020:common:projects:abstraction&noheader}}
  
 =====Locational Awareness===== =====Locational Awareness=====
Line 30: Line 33:
  
 <cli> <cli>
-yourpi:~/src/c4eng/led0$ gpio readall+yourpi:~/src/desig/led0$ gpio readall
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
Line 57: Line 60:
  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |  | BCM | wPi |   Name  | Mode | V | Physical | V | Mode | Name    | wPi | BCM |
  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+  +-----+-----+---------+------+---+---Pi 4B--+---+------+---------+-----+-----+
-yourpi:~/src/c4eng/led0$ +yourpi:~/src/desig/led0$ 
 </cli> </cli>
  
Line 103: Line 106:
  
 {{ :haas:fall2020:common:projects:breadboardlogic.png?400 |}} {{ :haas:fall2020:common:projects:breadboardlogic.png?400 |}}
 +
 +Here's a good video overview of the functionality of a breadboard:
 +
 +  * https://www.youtube.com/watch?v=6WReFkfrUIk
 ====(1) T-cobbler and data cable==== ====(1) T-cobbler and data cable====
 In your kit should be a T-shaped device (known as the "T-cobbler" with some aspect of pin names silkscreened on it, and a 40-pin ribbon cable). Colors may vary, but essentially it looks like this: In your kit should be a T-shaped device (known as the "T-cobbler" with some aspect of pin names silkscreened on it, and a 40-pin ribbon cable). Colors may vary, but essentially it looks like this:
Line 140: Line 147:
 Take note of how everything is being plugged in, and what connection on the T-cobbler is being utilized. Take note of how everything is being plugged in, and what connection on the T-cobbler is being utilized.
  
-Notice how the circuit runs from ground to resistor to LED to pin "GPIO17/Physical pin 11/Wiring Pi pin 0"+Notice how the circuit runs from ground to LED to resistor to pin "GPIO17/Physical pin 11/Wiring Pi pin 0" 
 + 
 +Before you seek to actually test your circuit, please get verification to proceed from the class channel on discord by posting a clear picture of everything. There are MANY moving parts, and especially as we have our first exposure, it is best to insert as many quality control checks as possible to ensure the greatest chances of mistakes are mitigated.
  
 ====Testing connectivity==== ====Testing connectivity====
Line 159: Line 168:
  
 <cli> <cli>
-yourpi:~/src/c4eng/led0$ gpio mode 0 OUT+yourpi:~/src/desig/led0$ gpio mode 0 OUT
 </cli> </cli>
  
Line 175: Line 184:
  
 <cli> <cli>
-yourpi:~/src/c4eng/led0$ gpio write 0 1      ## activate voltage on wiringpi pin 0 (turn on) +yourpi:~/src/desig/led0$ gpio write 0 1      ## activate voltage on wiringpi pin 0 (turn on) 
-yourpi:~/src/c4eng/led0$ gpio write 0 0      ## deactivate voltage on wiringpi pin 0 (turn off)+yourpi:~/src/desig/led0$ gpio write 0 0      ## deactivate voltage on wiringpi pin 0 (turn off)
 </cli> </cli>
  
Line 182: Line 191:
  
 If you get no activity out of the LED, try reversing it and try again. If you get no activity out of the LED, try reversing it and try again.
 +
 =====Program===== =====Program=====
-It is your task to write a program to interface with an LED (light emitting diode), a nice software-hardware connection, on your raspberry pi.+It is your task to compile, run, and understand a program to interface with an LED (light emitting diode), a nice software-hardware connection, on your raspberry pi
 + 
 +The program files provided for this project are complete. You merely have to get it on your pi, compile it, and run it, with the appropriate circuitry hooked up to the specified places. You will want to make sure you UNDERSTAND what is going on. 
 + 
 +In future projects you will start implementing more logic to attain further functionality. 
 + 
 +====Grabbing project resources (on lab46)==== 
 +I have prepared a **grabit** for resources related to this project. To obtain: 
 + 
 +<cli> 
 +lab46:~/src/desig$ grabit desig led0 
 +make: Entering directory '/var/public/SEMESTER/desig/lob0' 
 +'/var/public/SEMESTER/desig/led0/Makefile' -> '/home/user/src/desig/led0/Makefile' 
 +'/var/public/SEMESTER/desig/led0/led0.c' -> '/home/user/src/desig/led0/led0.c' 
 +make: Leaving directory '/var/public/SEMESTER/desig/led0' 
 +lab46:~/src/desig$  
 +</cli> 
 + 
 +At which point you can change into the newly created and populated **led0** directory. 
 + 
 +====Getting project resources from lab46 to your pi==== 
 +Okay, you've snagged the project files on lab46. Now, how to get them to your pi? 
 + 
 +The same way you've been juggling project files already, by using your mercurial repository! 
 + 
 +Using the **hg** tool, be sure to **add**, **commit**, and **push** successfully on lab46. 
 + 
 +Then, over on your pi, use **hg** to **pull** and **update** the new changes into place. Then you can proceed.
  
 ====On your pi==== ====On your pi====
-Develop, test, and run this program on your pi. When done, submit it on lab46.+Study and run this program on your pi in conjunction with testing and verifying operation of your properly hooked up electronics circuit. When done, submit it on lab46.
  
 To utilize the needed functionality for this project, you will need to ensure you have the following packages installed: To utilize the needed functionality for this project, you will need to ensure you have the following packages installed:
Line 197: Line 234:
  
 <cli> <cli>
-yourpi:~/src/c4eng/led0$ gpio readall+yourpi:~/src/desig/led0$ gpio readall
 Oops - unable to determine board type... model: 17 Oops - unable to determine board type... model: 17
 </cli> </cli>
Line 204: Line 241:
  
 <cli> <cli>
-yourpi:~/src/c4eng/led0$ wget https://project-downloads.drogon.net/wiringpi-latest.deb+yourpi:~/src/desig/led0$ wget https://project-downloads.drogon.net/wiringpi-latest.deb
 ... ...
-yourpi:~/src/c4eng/led0$ sudo dpkg -i wiringpi-latest.deb+yourpi:~/src/desig/led0$ sudo dpkg -i wiringpi-latest.deb
 ... ...
-yourpi:~/src/c4eng/led0$ rm -f wiringpi-latest.deb+yourpi:~/src/desig/led0$ rm -f wiringpi-latest.deb
 </cli> </cli>
- 
-===The program (led0.c)=== 
-The program you will need is once again provided via a grabit on lab46, source code also included here for study: 
- 
-<code c> 
-#include <stdio.h>     // include support for C standard library input/output functionality 
-#include <stdlib.h>    // include support for general C standard library functionality 
-#include <wiringPi.h>  // include support for wiringPi library functionality 
- 
-int main (void)        // every program has a starting point, for us in C, it is main() 
-{ 
-    ////////////////////////////////////////////////////////////////////////// 
-    // 
-    // Declare variables 
-    // 
-    int gpio_pin  = 17;   // set to GPIO pin we are hooking LED circuit into 
- 
-    ////////////////////////////////////////////////////////////////////////// 
-    // 
-    // Initialize wiringPi subsystem and verify no errors occurred 
-    // 
-    if (wiringPiSetup() == -1) 
-    { 
-        fprintf (stderr, "[error] wiringPi initialization has failed!\n"); 
-        exit (1); 
-    } 
- 
-    ////////////////////////////////////////////////////////////////////////// 
-    // 
-    // Display usage information to the user 
-    // 
-    fprintf (stdout, "Starting program, interrupt to terminate (CTRL-c)\n"); 
- 
-    ////////////////////////////////////////////////////////////////////////// 
-    // 
-    // Initialize utilized GPIO pin to OUTPUT mode 
-    // 
-    pinMode (gpio_pin, OUTPUT); 
- 
-    ////////////////////////////////////////////////////////////////////////// 
-    // 
-    // Repeat until interrupted (CTRL-c to interrupt) 
-    // 
-    while (1) 
-    { 
-        digitalWrite (gpio_pin, LOW);   // set signal on gpio_pin LOW 
-        delay (1000);                   // delay for 1000ms 
-        digitalWrite (gpio_pin, HIGH);  // set signal on gpio_pin HIGH 
-        delay (1000);                   // delay for 1000ms 
-    } 
- 
-    return (0); 
-} 
-</code> 
- 
-The program for this project is complete. You merely have to get it on your pi, compile it, and run it, with the appropriate circuitry hooked up to the specified places. In future projects you will start implementing more logic to attain further functionality. 
-=====Specifications===== 
-Your program should: 
- 
-  * have valid, descriptive variable names of length //no shorter than// 4 symbols 
-  * have consistent, well-defined indentation (no less than 4 spaces per level of indentation) 
-    * all code within the same scope aligned to its indentation level 
-  * have proximal comments explaining your rationale and what is going on, throughout your code 
-  * perform the intended operation, outputting the correct/accurate information in indicated format 
-  * at the end of your main() function, use a single return statement to conclude your code, return a 0 indicating successful operation 
- 
-=====Grabbing project resources===== 
-I have prepared a **grabit** for resources related to this project. To obtain: 
- 
-<cli> 
-lab46:~/src/desig$ grabit desig led0 
-make: Entering directory '/var/public/SEMESTER/desig/lob0' 
-'/var/public/SEMESTER/desig/led0/Makefile' -> '/home/user/src/desig/led0/Makefile' 
-'/var/public/SEMESTER/desig/led0/led0.c' -> '/home/user/src/desig/led0/led0.c' 
-make: Leaving directory '/var/public/SEMESTER/desig/led0' 
-lab46:~/src/desig$  
-</cli> 
- 
-At which point you can change into the newly created and populated **led0** directory. 
  
 =====Compiling===== =====Compiling=====
Line 312: Line 270:
   * Track/version the source code in a repository   * Track/version the source code in a repository
   * Submit a copy of your source code to me using the **submit** tool.   * Submit a copy of your source code to me using the **submit** tool.
 +  * Post required images and obtain needed confirmation to proceed from me on class channel on discord.
  
 To submit this program to me using the **submit** tool, run the following command at your lab46 prompt: To submit this program to me using the **submit** tool, run the following command at your lab46 prompt:
Line 329: Line 288:
 <code> <code>
 26:led0:final tally of results (26/26) 26:led0:final tally of results (26/26)
-*:led0:post picture of unpowered layout to #desig and get approval [4/4+*:led0:post picture of unpowered layout to #desig and get approval [6/6
-*:led0:post picture to #desig by Sunday before deadline [2/2+*:led0:post picture to #desig by Sunday before deadline [4/4
-*:led0:post picture of powered LED to #desig [4/4]  +*:led0:post picture of powered LED to #desig [6/6]  
-*:led0:grabit the code on lab46 by Sunday before deadline [2/2]+*:led0:grabit the code on lab46 by Sunday before deadline [4/4]
 *:led0:code is pushed to lab46 repository [6/6] *:led0:code is pushed to lab46 repository [6/6]
-*:led0:no negative compiler messages for program [6/6] 
 </code> </code>
  
haas/fall2020/common/projects/led0.1598374158.txt.gz · Last modified: 2020/08/25 12:49 by wedge