User Tools

Site Tools


notes:c4eng:fall2023: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:fall2023:projects:ptb1 [2023/10/19 02:21] mwinter4notes:c4eng:fall2023:projects:ptb1 [2023/10/19 02:54] (current) mwinter4
Line 14: Line 14:
 <code> <code>
 hg add *  hg add * 
-hg commit -m "//YOUR COMMIT MESSAGE HERE//+hg commit -m "YOUR COMMIT MESSAGE HERE" 
 hg push  hg push 
 </code>  </code> 
  
-Assuming you've encountered no errors, you should now be able to retrieve these files on your pi +Assuming you've encountered no errors, you should now be able to retrieve these files on your pi 
 +<code> 
 +hg pull  
 +hg update 
 +</code>
 =====PARTS===== =====PARTS=====
  
Line 26: Line 29:
 ====button==== ====button====
 each button should be wired the same way, just to different pins. each button needs a 3.3v ran through a 10Kohm resistor and a ground wire, with a final wire with a 10kohm resistor to a gpio pin. Within wiringpi, the pin must be set to input mode. The gpio wire should also be on the opposite side of the 3.3v wire and the ground wire. You made need to switch which pin your wires are connected to if your button is not working properly. You can also check if the button is working by looking at the gpio readall table before and after the button is being pressed, and you should see a change in voltage for that gpio pin (reminder to change voltage first gpio mode "pin" out, then gpio write "pin" 1). each button should be wired the same way, just to different pins. each button needs a 3.3v ran through a 10Kohm resistor and a ground wire, with a final wire with a 10kohm resistor to a gpio pin. Within wiringpi, the pin must be set to input mode. The gpio wire should also be on the opposite side of the 3.3v wire and the ground wire. You made need to switch which pin your wires are connected to if your button is not working properly. You can also check if the button is working by looking at the gpio readall table before and after the button is being pressed, and you should see a change in voltage for that gpio pin (reminder to change voltage first gpio mode "pin" out, then gpio write "pin" 1).
 +
 +=====LOGIC=====
 +
 +**Synopsis:**
 +To achieve our desired outcome with only one if statement, we'll need to implement bit shifting and a for loop. 
 +It would also be helpful, first, to create an array if our pins are not connected sequentially.  
 +
 +=====ARRAYS IN C=====
 +
 +To declare an array in C is similar to declaring any variable: we declare the data type (in arrays, the data type of all the elements), name the variable, and assign a value (or a matrix of values for arrays). 
 +
 +<code> 
 +int myArray[10] = {5,2,22,6,...}; 
 +</code>
 +
 +In our sample, 10 is the number of elements we have (not shown).
notes/c4eng/fall2023/projects/ptb1.1697682066.txt.gz · Last modified: 2023/10/19 02:21 by mwinter4