User Tools

Site Tools


haas:fall2021:common:projects:iwb1

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:fall2021:common:projects:iwb1 [2021/09/26 12:10] – [Objective] wedgehaas:fall2021:common:projects:iwb1 [2021/09/28 12:42] (current) – [Reading] wedge
Line 8: Line 8:
   * two buttons (one to increment the count, one to decrement the count)   * two buttons (one to increment the count, one to decrement the count)
 =====Abstraction===== =====Abstraction=====
-{{page>haas:fall2020:common:projects:abstraction&noheader}}+{{page>haas:fall2021:common:projects:abstraction&noheader}}
  
 =====Locational Awareness===== =====Locational Awareness=====
-{{page>haas:fall2020:common:projects:location&noheader}}+{{page>haas:fall2021:common:projects:location&noheader}}
  
 =====Reading===== =====Reading=====
Line 18: Line 18:
   * [[https://publications.gbdirect.co.uk//c_book/chapter7/|Chapter 7]]   * [[https://publications.gbdirect.co.uk//c_book/chapter7/|Chapter 7]]
  
 +Also, some background information on buttons:
 +
 +  * https://learn.sparkfun.com/tutorials/button-and-switch-basics/all
 =====Background===== =====Background=====
 For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a circuit containing multiple LEDs and a button to your breadboard and witnessing your ability to access and control them via software. For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a circuit containing multiple LEDs and a button to your breadboard and witnessing your ability to access and control them via software.
Line 33: Line 36:
  
 <cli> <cli>
-yourpi:~/src/desig/iwb1$ gpio readall+yourpi:~/src/SEMESTER/DESIG/iwb1$ 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 83: Line 86:
 This circuit is basically an enhancement upon the one you made for the led1 project. So the parts needed has some similar items, but also some new ones. This circuit is basically an enhancement upon the one you made for the led1 project. So the parts needed has some similar items, but also some new ones.
  
-In this project, we will be hooking up two different peripherals to some of our Raspberry Pi pins: a set of light emitting diodes (LED) and a button, and then proceed to interface with them to access and control their state (of being ON or OFF).+In this project, we will be hooking up two different peripherals to some of our Raspberry Pi pins: a set of light emitting diodes (LED) and buttons, and then proceed to interface with them to access and control their state (each one in some combination of being ON or OFF).
  
 You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", which when lit, indicates the device is powered on, among many, MANY, **MANY** other applications. You have likely encountered LEDs endlessly in your everyday life: commonly used as a "power light", which when lit, indicates the device is powered on, among many, MANY, **MANY** other applications.
Line 91: Line 94:
 For this endeavour, you will need to obtain the following items out of the electronics kit you obtained for the class: For this endeavour, you will need to obtain the following items out of the electronics kit you obtained for the class:
  
-{{ :haas:fall2020:common:projects:iwb1partslist.png |}}+{{ :haas:fall2021:common:projects:iwb1partslist.png |}}
  
 =====The Circuit to Construct===== =====The Circuit to Construct=====
Line 111: Line 114:
  
 =====Program===== =====Program=====
-It is your task to compile, run, and understand a program to interface with the LEDs (light emitting diodes) and button. The button provides **input** into the mix, instead of just generating output (ie adjusting the state of the LED).+It is your task to compile, run, and understand a program to interface with the LEDs (light emitting diodes) and button. The buttons provide **input** into the mix, instead of just generating output (ie adjusting the state of the LED).
  
-The provided program performs a similar operation as in the previous led1 project; it is your task to:+The provided source code (via grabit) is set up to provide the infrastructure to support both the LEDs and the buttons for this project. While you have to determine where they interface, the code will initialize the pins as appropriate. Your main task is to:
  
-  * expand the program to support FOUR LEDs+  * implement a program that counts 4 LEDs in the direction input specifies 
 +    * if one button is pressed, increment the count from the current value to 15, rolling over to 0 as needed 
 +    * if the other button is pressed, decrement the count from the current value to 0, rolling over to 15 as needed 
 +    * have a 50mS - 500mS delay between state changes 
 +    * pressing the button enables the change for that next state (after the current delay expires) 
 +  * implement support for FOUR LEDs
     * each LED connected to a unique GPIO line     * each LED connected to a unique GPIO line
-  * adapt the program to "act" on button presses. That is, it only proceeds from one step to the next when you press the button. +  * implement support for TWO buttons 
-    * NOTE: you may discover there to be "noise" or undesired behaviour when pressing the button and expecting a clean action. This can be cleaned up with additional program logic. +    * adapt the program to "act" on button presses. That is, it only proceeds from one step to the next when you press button. 
-  * do NOT remove the delay. You may shorten (no shorter than 50mS) or lengthen the delay, but do not remove it entirely.+
 ====Grabbing project resources (on lab46)==== ====Grabbing project resources (on lab46)====
 I have prepared a **grabit** for resources related to this project. To obtain: I have prepared a **grabit** for resources related to this project. To obtain:
  
 <cli> <cli>
-lab46:~/src/desig$ grabit desig iwb1 +lab46:~/src/SEMESTER/DESIG$ grabit desig iwb1 
-make: Entering directory '/var/public/SEMESTER/desig/iwb1' +make: Entering directory '/var/public/SEMESTER/DESIG/iwb1' 
-'/var/public/SEMESTER/desig/iwb1/Makefile' -> '/home/user/src/desig/iwb1/Makefile' +'/var/public/SEMESTER/DESIG/iwb1/Makefile' -> '/home/user/src/SEMESTER/DESIG/iwb1/Makefile' 
-'/var/public/SEMESTER/desig/iwb1/iwb1.c' -> '/home/user/src/desig/iwb1/iwb1.c' +'/var/public/SEMESTER/DESIG/iwb1/iwb1.c' -> '/home/user/src/SEMESTER/DESIG/iwb1/iwb1.c' 
-make: Leaving directory '/var/public/SEMESTER/desig/iwb1' +make: Leaving directory '/var/public/SEMESTER/DESIG/iwb1' 
-lab46:~/src/desig+lab46:~/src/SEMESTER/DESIG
 </cli> </cli>
  
Line 178: Line 186:
  
 <cli> <cli>
-lab46:~/src/desig/iwb1$ submit desig iwb1 iwb1.c +lab46:~/src/SEMESTER/DESIG/iwb1$ make submit
-Submitting desig project "iwb1": +
-    -> iwb1.c(OK) +
- +
-SUCCESSFULLY SUBMITTED+
 </cli> </cli>
  
Line 193: Line 197:
 *:iwb1:post picture of unpowered layout to #desig and get approval [8/8] *:iwb1:post picture of unpowered layout to #desig and get approval [8/8]
 *:iwb1:post picture to #desig by Sunday before deadline [4/4] *:iwb1:post picture to #desig by Sunday before deadline [4/4]
-*:iwb1:post picture of powered LEDs in layout to #desig [8/8] +*:iwb1:post picture of button-enabled LED count in layout to #desig [8/8] 
 *:iwb1:grabit on the code on lab46 by Sunday before deadline [4/4] *:iwb1:grabit on the code on lab46 by Sunday before deadline [4/4]
 *:iwb1:iwb1.c code adequately modified per project requirements [20/20] *:iwb1:iwb1.c code adequately modified per project requirements [20/20]
haas/fall2021/common/projects/iwb1.1632658246.txt.gz · Last modified: 2021/09/26 12:10 by wedge