This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
haas:fall2020:common:projects:led1 [2021/09/05 13:58] – [On your pi] wedge | haas:fall2020:common:projects:led1 [2021/09/05 14:01] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 203: | Line 203: | ||
With an expanded set of LED circuits, be sure to test the operation of each one. | With an expanded set of LED circuits, be sure to test the operation of each one. | ||
=====Program===== | =====Program===== | ||
- | 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 | + | It is your task to compile, run, expand upon, and understand |
- | If " | + | The program files provided for this project are, while not complete, minimally functional. You merely have to get it on your pi, compile it, and run it, and expand it with the appropriate circuitry hooked up to the specified places. You will want to make sure you UNDERSTAND what is going on. So be sure to ASK QUESTIONS, and do so EARLY enough so that you aren't in a mad dash to make the deadline. |
- | < | + | In future projects you will start implementing more logic to attain further functionality. |
- | 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, a good base to start from. Be sure to ASK QUESTIONS, and do so EARLY enough so that you aren't in a mad dash to make the deadline. | + | |
- | + | ||
- | =====Bitwise | + | |
- | Since the off/on state of each LED is essentially binary in nature (or one bit of an overall sequence), why not utilize the powerful bitwise tools available | + | |
- | + | ||
- | ====bitwise-AND==== | + | |
- | C provides a bitwise AND operator, the **< | + | |
- | + | ||
- | <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 | + | |
- | // | + | |
- | // | + | |
- | </ | + | |
- | + | ||
- | Remember the truth table for the xOR: | + | |
- | + | ||
- | < | + | |
- | ( 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 333: | Line 233: | ||
====On your pi==== | ====On your pi==== | ||
- | Implement the needed | + | 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 414: | Line 314: | ||
* Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction | * Solutions not utilizing indentation to promote scope and clarity will be subject to a 25% overall deduction | ||
* Solutions not organized and easy to read are subject to a 25% overall deduction | * Solutions not organized and easy to read are subject to a 25% overall deduction | ||
+ |