haas:fall2020:common:projects:led1
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
haas:fall2020:common:projects:led1 [2020/09/03 16:23] – wedge | haas:fall2020:common:projects:led1 [2021/09/05 09:58] – [On your pi] wedge | ||
---|---|---|---|
Line 3: | Line 3: | ||
=====Objective===== | =====Objective===== | ||
- | To expand upon our previous efforts, through wiring up additional LEDs and generating a " | + | To expand upon our previous efforts, through wiring up additional LEDs and discovering what pattern |
We also further utilize time constraints, | We also further utilize time constraints, | ||
Line 106: | Line 106: | ||
{{ : | {{ : | ||
+ | |||
+ | Here's a good video overview of the functionality of a breadboard: | ||
+ | |||
+ | * https:// | ||
====(1) T-cobbler and data cable==== | ====(1) T-cobbler and data cable==== | ||
In your kit should be a T-shaped device (known as the " | In your kit should be a T-shaped device (known as the " | ||
Line 144: | Line 148: | ||
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 | + | Notice how the circuit runs from ground to LED to resistor |
Please keep in mind: | Please keep in mind: | ||
Line 155: | Line 159: | ||
<WRAP info> | <WRAP info> | ||
+ | <WRAP info>It may be clarifying if you arranged your four LEDs in a row, from right to left, in order of your GPIO pins you've plugged into.</ | ||
====Testing connectivity==== | ====Testing connectivity==== | ||
To verify whether everything is hooked up correctly (including the correct positioning of the LED), please try the following: | To verify whether everything is hooked up correctly (including the correct positioning of the LED), please try the following: | ||
Line 172: | Line 177: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 188: | Line 193: | ||
<cli> | <cli> | ||
- | yourpi: | + | yourpi: |
- | yourpi: | + | yourpi: |
</ | </ | ||
Line 196: | Line 201: | ||
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. | ||
+ | With an expanded set of LED circuits, be sure to test the operation of each one. | ||
=====Program===== | =====Program===== | ||
- | It is your task to compile, run, expand upon, and understand | + | It is your task to write a C program that interfaces successfully with four independently connected LED circuits, arranged in some orientation to ascertain an order or positioning, where your program will (in endless fashion, or until being manually interrupted) display a count (in binary) of values from 0 to 15 (then rollover, or reset). |
+ | |||
+ | If " | ||
+ | |||
+ | < | ||
+ | 0 0 0 0 | ||
+ | 0 0 0 1 | ||
+ | 0 0 1 0 | ||
+ | 0 0 1 1 | ||
+ | 0 1 0 0 | ||
+ | 0 1 0 1 | ||
+ | 0 1 1 0 | ||
+ | 0 1 1 1 | ||
+ | 1 0 0 0 | ||
+ | 1 0 0 1 | ||
+ | 1 0 1 0 | ||
+ | 1 0 1 1 | ||
+ | 1 1 0 0 | ||
+ | 1 1 0 1 | ||
+ | 1 1 1 0 | ||
+ | 1 1 1 1 < | ||
+ | 0 0 0 0 < | ||
+ | 0 0 0 1 | ||
+ | 0 0 1 0 | ||
+ | ... | ||
+ | </ | ||
+ | |||
+ | The program files provided for this project are, while not complete, | ||
+ | |||
+ | =====Bitwise logic===== | ||
+ | Since the off/on state of each LED is essentially binary in nature | ||
+ | |||
+ | ====bitwise-AND==== | ||
+ | C provides | ||
+ | |||
+ | <code c> | ||
+ | char value = 5; // 00000101 in binary | ||
+ | value = value & 6; // | ||
+ | // & 00000110 | ||
+ | // | ||
+ | // | ||
+ | </ | ||
+ | |||
+ | Remember the truth table for the AND: | ||
+ | |||
+ | < | ||
+ | ( AND ) | ||
+ | A B | X | ||
+ | ====+=== | ||
+ | F F | F | ||
+ | F T | F | ||
+ | T F | F | ||
+ | T T | T | ||
+ | </ | ||
+ | |||
+ | Think of how this property could be used in combination with other concepts we've learned about in C to solve the problem at hand. | ||
+ | |||
+ | ====bitwise-iOR==== | ||
+ | C provides a bitwise inclusive OR operator, the **< | ||
+ | |||
+ | <code c> | ||
+ | char value = 5; // 00000101 in binary | ||
+ | value = value | 6; // | ||
+ | // & 00000110 | ||
+ | // | ||
+ | // | ||
+ | </ | ||
+ | |||
+ | Remember the truth table for the iOR: | ||
+ | |||
+ | < | ||
+ | ( iOR ) | ||
+ | A B | X | ||
+ | ====+=== | ||
+ | F F | F | ||
+ | F T | T | ||
+ | T F | T | ||
+ | T T | T | ||
+ | </ | ||
+ | |||
+ | Think of how this property could be used in combination with other concepts we've learned about in C to solve the problem at hand. | ||
+ | |||
+ | ====bitwise-xOR==== | ||
+ | C provides a bitwise exclusive OR operator, the **< | ||
+ | |||
+ | <code c> | ||
+ | char value = 5; // 00000101 in binary | ||
+ | value = value ^ 6; // | ||
+ | // & 00000110 | ||
+ | // | ||
+ | // | ||
+ | </ | ||
- | The program files provided | + | Remember the truth table for the xOR: |
- | In future projects you will start implementing more logic to attain further functionality. | + | < |
+ | ( xOR ) | ||
+ | A B | X | ||
+ | ====+=== | ||
+ | F F | F | ||
+ | F T | T | ||
+ | T F | T | ||
+ | T T | F | ||
+ | </ | ||
+ | Think of how this property could be used in combination with other concepts we've learned about in C to solve the problem at hand. | ||
====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: | ||
Line 227: | Line 333: | ||
====On your pi==== | ====On your pi==== | ||
- | 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. | + | Implement the needed |
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: |
haas/fall2020/common/projects/led1.txt · Last modified: 2021/09/05 10:01 by 127.0.0.1