User Tools

Site Tools


haas:fall2020:common:projects:clr0

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:clr0 [2020/10/09 14:54] – [Grabbing project resources (on lab46)] wedgehaas:fall2020:common:projects:clr0 [2020/10/09 19:49] (current) – [Input and Output via the GPIO pins on the pi] wedge
Line 18: Line 18:
 ALSO: read through Chapter 5 in the [[https://lab46.g7n.org/downloads/tutorial.pdf|FreeNove Tutorial]] ALSO: read through Chapter 5 in the [[https://lab46.g7n.org/downloads/tutorial.pdf|FreeNove Tutorial]]
  
 +AND: the wiringPi API on [[http://wiringpi.com/reference/software-pwm-library/|Sofware PWM functionality]]
 =====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 an RGB LED to your breadboard and witnessing your ability to access and control it in varying states of on and off (more than just simply "ON" and "OFF") via a software-based Pulse Width Modulation (PWM) scheme. For this project, you will be working with a C program using the wiringPi library on the Raspberry Pi, wiring up a circuit containing an RGB LED to your breadboard and witnessing your ability to access and control it in varying states of on and off (more than just simply "ON" and "OFF") via a software-based Pulse Width Modulation (PWM) scheme.
Line 33: Line 34:
  
 <cli> <cli>
-yourpi:~/src/desig/iwb2$ gpio readall+yourpi:~/src/desig/clr0$ 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 107: Line 108:
  
 =====Program===== =====Program=====
-It is your task to implement a program (iwb2.c) that accepts input from the buttons, and outputs to the LEDbarin accordance with the following: +It is your task to obtain, study, and complete a program (clr0.c) that will pseudorandomly set the RGB LED to different coloursonce per secondMost of the code has been provided for youyou must complete the part as indicated in the comments.
- +
-  * the LEDbar displays a 10-bit binary number (there exists code in previous projects that accomplishes this task +
-  * ONE of the two buttons is an INCREMENT operationBy pressing it, your program needs to recognize it is pressed, and increment the number being displayed by 1 (per update) +
-  * the OTHER of the two buttons is a DECREMENT operation. By pressing ityour program needs to recognize it is pressed, and decrement the number being displayed by 1 (per update) +
- +
-  * some things of note: +
-    * each LED connected to a unique GPIO line +
-    * each BUTTON connected to a unique GPIO line +
-  * do NOT remove the delay. You may shorten (no shorter than 50mS) or lengthen the delay, but do not remove it entirely.+
  
 +  * Retain the structure of the grabit code for your submission to be evaluated (do NOT use any added functions).
 +  * Retain the variables of the grabit code, as named, in your submission to be evaluated.
 +  * From the FreeNove tutorial or the wiringPi API on sofware PWM functionality, determine how to set the obtained red/green/blue values to the appropriate pins on your RGB LED, so that it will light up with those colour values (and change, each second the program is running, to a different value).
 +  * Update your clr0.c program to perform this action to complete it.
 +  * do NOT remove the delay. You may shorten (no shorter than 500mS, please) or lengthen the delay, but do not remove it entirely.
  
 +NOTE: There may be functionally equivalent code in the resources for this project. You are not to copy and paste it, but instead to identify the needed functionality and translate it into a form compatible with the grabit program provided for this project. Failure to do so will not result in success.
  
 =====Compiling===== =====Compiling=====
haas/fall2020/common/projects/clr0.1602255258.txt.gz · Last modified: 2020/10/09 14:54 by wedge