User Tools

Site Tools


haas:fall2024:c4eng:projects:stl2

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:fall2024:c4eng:projects:stl2 [2024/09/30 15:09] wedgehaas:fall2024:c4eng:projects:stl2 [2024/10/07 10:55] (current) – [Components and wiring] wedge
Line 4: Line 4:
 </WRAP> </WRAP>
  
-======PROJECT: Seeing The Light (STL1)======+======PROJECT: Seeing The Light (STL2)======
  
 =====OBJECTIVE===== =====OBJECTIVE=====
-We continue our explorations of the electronics kit, by adding additional LEDs to control them in unison with a C program on our pi, having them count in binary.+Time to explore optimizing our logic further, through the use of a loop and demonstrating the effectiveness of our logic by scaling up the number of LEDs in our counter (to at least 8).
  
 =====PROCESS===== =====PROCESS=====
Line 20: Line 20:
  
 =====TASK===== =====TASK=====
-After exploring, assembling, and testing the intended circuit (LEDs), adapt the provided C code to use the bank of connected LEDs to count in binary from 0000 to 1111 (0 to 15).+After exploring, assembling, and testing the intended circuit (8+ LEDs), adapt the provided C code to use the bank of connected LEDs to count in binary from 00000000 to at least 11111111 (0 to 255).
  
-Using the current value of count, your task is to make use of **if** statements and **bitwise logic** to determine from an ongoing count the state of the individual bits.+Using the current value of count, your task is to make use of ONE **if** statement and copious use of **bitwise logic** to determine from an ongoing count the state of the individual bits.
  
-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).+It is your task to write a C program that interfaces successfully with the eight or more 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 at least 255 (then rollover, or reset).
  
 If "1" means the LED in that position is ON, and "0" means the LED in that position is OFF, then you want to write a program that performs the following progression (over and over again): If "1" means the LED in that position is ON, and "0" means the LED in that position is OFF, then you want to write a program that performs the following progression (over and over again):
  
 <code> <code>
-0 0 0 0 +0 0 0 0 0 0 0 0 
-0 0 0 1 +0 0 0 0 0 0 0 1 
-0 0 1 0 +0 0 0 0 0 0 1 0 
-0 0 1 1 +0 0 0 0 0 0 1 1 
-0 1 0 0 +0 0 0 0 0 1 0 0 
-0 1 0 1 +0 0 0 0 0 1 0 1 
-0 1 1 0 +0 0 0 0 0 1 1 0 
-0 1 1 1 +0 0 0 0 0 1 1 1 
-1 0 0 0 +0 0 0 0 1 0 0 0 
-1 0 0 1 +. . . 
-1 0 1 0 +1 1 1 1 1 0 0 1 
-1 0 1 1 +1 1 1 1 1 0 1 0 
-1 1 0 0 +1 1 1 1 1 0 1 1 
-1 1 0 1 +1 1 1 1 1 1 0 0 
-1 1 1 0 +1 1 1 1 1 1 0 1 
-1 1 1 1   <-- 15, the maximum value to display +1 1 1 1 1 1 1 0 
-0 0 0 0   <-- 0, we "roll over" and start again +1 1 1 1 1 1 1 1   <-- 255, the maximum value to display when there are 8 bits/LEDs 
-0 0 0 1 +0 0 0 0 0 0 0 0   <-- 0, we "roll over" and start again 
-0 0 1 0 +0 0 0 0 0 0 0 1 
-...+0 0 0 0 0 0 1 0 
 +. . .
 </code> </code>
 +
 =====GRABIT===== =====GRABIT=====
 To assist with consistency across all implementations, data files for use with this project are available on lab46 via the **grabit** tool. Be sure to obtain it and ensure your implementation properly works with the provided data. To assist with consistency across all implementations, data files for use with this project are available on lab46 via the **grabit** tool. Be sure to obtain it and ensure your implementation properly works with the provided data.
Line 57: Line 59:
 </cli> </cli>
  
-=====EDIT===== +=====Components and wiring=====
-You will want to go [[/notes/c4eng/fall2024/projects/stl1|here]] to edit and fill in the various sections of the document:+
  
-  * [[/notes/c4eng/fall2024/projects/stl1|https://lab46.g7n.org/notes/c4eng/fall2024/projects/stl1]]+An example of one way to wire up the LED bar:
  
-{{page>notes:c4eng:fall2024:projects:stl1&nouser&nodate&nomdate}}+{{:haas:fall2019:c4eng:projects:ledbar.png?400|}}
  
 +=====EDIT=====
 +You will want to go [[/notes/c4eng/fall2024/projects/stl2|here]] to edit and fill in the various sections of the document:
 +
 +  * [[/notes/c4eng/fall2024/projects/stl2|https://lab46.g7n.org/notes/c4eng/fall2024/projects/stl2]]
 +
 +{{page>notes:c4eng:fall2024:projects:stl2&nouser&nodate&nomdate}}
  
  
Line 71: Line 78:
 <code> <code>
 SET COUNTER TO ZERO SET COUNTER TO ZERO
-REPEAT: +REPEAT INFINITELY
-    SHOULD THE ONE'POSITION HAVE A ONE: +    SET PLACE TO ONE 
-        ACTIVATE THE ONE'PLACE +    REPEAT UNTIL PLACE IS GREATER THAN EIGHT: 
-    OTHERWISE: +        SHOULD THE PLACE POSITION HAVE A ONE: 
-        DEACTIVATE THE ONE'PLACE+            ACTIVATE THE PLACE’S LED 
 +        OTHERWISE: 
 +            DEACTIVATE THE PLACE’LED
  
-    SHOULD THE TWO'S POSITION HAVE A ONE: +        LET PLACE BECOME THE NEXT PLACE POSITION 
-        ACTIVATE THE TWO'PLACE +    KEEP GOING
-    OTHERWISE: +
-        DEACTIVATE THE TWO'PLACE +
- +
-    SHOULD THE FOUR'POSITION HAVE A ONE: +
-        ACTIVATE THE FOUR'S PLACE +
-    OTHERWISE: +
-        DEACTIVATE THE FOUR'S PLACE +
- +
-    SHOULD THE EIGHT'S POSITION HAVE A ONE: +
-        ACTIVATE THE EIGHT'S PLACE +
-    OTHERWISE: +
-        DEACTIVATE THE EIGHT'S PLACE+
  
     PAUSE FOR HUMAN PERCEPTION     PAUSE FOR HUMAN PERCEPTION
- 
     LET THE COUNTER BE INCREMENTED BY ONE     LET THE COUNTER BE INCREMENTED BY ONE
 +KEEP GOING
 </code> </code>
  
Line 136: Line 133:
  
 <code> <code>
-78:stl1:final tally of results (78/78+91:stl2:final tally of results (91/91
-*:stl1:used grabit to obtain project by the Sunday prior to duedate [13/13] +*:stl2:used grabit to obtain project by the Sunday prior to duedate [13/13] 
-*:stl1:clean compile, no compiler messages [13/13] +*:stl2:clean compile, no compiler messages [13/13] 
-*:stl1:program conforms to project specifications [39/39+*:stl2:program conforms to project specifications [13/13] 
-*:stl1:code tracked in lab46 semester repo [13/13]+*:stl2:uses at least eight LEDs for the binary counter [13/13] 
 +*:stl2:program uses only one selection structure in loop to do task [26/26
 +*:stl2:code tracked in lab46 semester repo [13/13]
 </code> </code>
  
haas/fall2024/c4eng/projects/stl2.1727708972.txt.gz · Last modified: 2024/09/30 15:09 by wedge