User Tools

Site Tools


notes:c4eng:fall2024:projects:ptb1

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
notes:c4eng:fall2024:projects:ptb1 [2024/10/17 13:12] – [GRABIT] dnayonotes:c4eng:fall2024:projects:ptb1 [2024/10/21 23:12] (current) – [ARRAYS IN C] dprado
Line 20: Line 20:
  
 ====LED bar==== ====LED bar====
 +The raspberry pi electronics kits came with small, lego-sized, rectangular prism-shaped bars containing 10 independent LED lights. These LED lights are not connected in series or parallel, and each light must be individually wired in order to properly function. The LEDs appear to be red, and the entire bar fits nicely right on the raspberry pi breadboard and occupies 10 adjacent rows. In stl2, we used these bars to create 8 or 10-bit binary counters. In this project, we are using these same bars to create another binary counter, but now we are adding buttons to reverse the order of the lights and begin counting down from the highest number possible. 
 ====button==== ====button====
 +similar to how we used the buttons in ptb0, we will need to find 2 buttons in our electronics kit which look like little squares with 4 small legs from each corner. To allow for the button to output and give a reading we need to physically hook the button up correctly. You do this by hooking one leg of the button to a direct line to ground. Then, another leg to 3.3v power through a 10 kΩ resistor and a final leg to a gpio pin through another 10 kΩ resistor. Once you have connected this button correctly you can then initialize it to a wpi pin value in the code before using the button. You will need to repeat these steps with another button as for ptb1 you will need 2 seperate buttons one for increasing count and on for decreasing count.
 =====LOGIC===== =====LOGIC=====
  
 =====ARRAYS IN C===== =====ARRAYS IN C=====
 +a data structure that allows you store multiple elements of the same data type in the same memory location. Arrays can contain many different date types and even other date structures. Once an array is initialized, it's size cannot be changed. However, you can change date elements at specific points in the array. 
 +
 +     int numbers[5] = {1, 2, 3, 4, 5};  //declares and creates an array that contains 5 integers 1,2,3,4,5
 +
 +     int thirdNumber = numbers[3];  //access 3rd data element in the array, which would be 3 in this case.  
 +
  
  
notes/c4eng/fall2024/projects/ptb1.1729170735.txt.gz · Last modified: 2024/10/17 13:12 by dnayo