This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:c4eng:fall2022:projects:vcc0 [2022/09/06 14:24] – [SPECIFICATIONS] wedge | notes:c4eng:fall2022:projects:vcc0 [2022/09/14 21:14] (current) – [COMPONENTS] ilaface | ||
---|---|---|---|
Line 5: | Line 5: | ||
====RELATIONAL OPERATORS==== | ====RELATIONAL OPERATORS==== | ||
+ | ^ Operator | ||
+ | | == | Checks if the values are equal or not, If yes, condition is true | (A == B)| | ||
+ | | != | Checks if the values are equal or not, If values are not equal, then condition is true | (A != B)| | ||
+ | | > | Checks if the value of left operand is greater than the value of right operand | ||
+ | | < | Checks if the value of the left operand is less than the value of right operand | ||
+ | | >= | Checks if the value of left operand is greater than or equal to the value of the right operand| (A >= B)| | ||
+ | | <= | Checks if the value of left operand is less than or equal to the value of the right operand | ||
====WIRINGPI INSTALL==== | ====WIRINGPI INSTALL==== | ||
- | ====WIRINGPI COMMAND-LINE USAGE==== | + | In order to navigate successfully throughout the wiringPi library in the command-line, a few key functions are going to be needed: |
+ | |||
+ | gpio readall: This allows view of the table that correlates to the pins and positions on the breadboard. It gives the pin number in terms of what the Pi reads and in terms of what code for the project reads. It allows tells whether the pin is in Input mode or Output mode. | ||
+ | |||
+ | gpio mode: This allows one to change the mode of specific pins from Input to Output and visa versa. Once the command is typed, it will ask for the desired pin number (found in the readall table) and the desired mode (In/Out). | ||
+ | |||
+ | gpio write: Once the desired pins have been hooked up on the breadboard and configured on the Pi, this function is used to switch between supplying voltage or not. Once typed, it will ask for the desired pin (which should already be configured) and a choice of 0(off) and 1(on). | ||
=====ELECTRONICS===== | =====ELECTRONICS===== | ||
Line 25: | Line 38: | ||
* https:// | * https:// | ||
+ | The purpose of the breadboard is to make quick electrical connections between components- like resistors, LEDs, capacitors, etc- so that you can test your circuit before permanently soldering it together. | ||
====COMPONENTS==== | ====COMPONENTS==== | ||
+ | **Breadboard** | ||
+ | A breadboard consists of plastic block holding a matrix of electrical sockets of a size suitable for gripping thin connecting wire, component wires or the pins of transistors and integrated circuits. The sockets are connected inside the board (by metal clips), in rows of five sockets horizontally. | ||
+ | |||
+ | **GPIO Expansion Board** | ||
+ | |||
+ | The GPIO Expansion board connects to the pins of your pi via a ribbon cable. The GPIO expansion board is then fitted onto the breadboard making the functionality of the pins available to use on the breadboard. | ||
+ | |||
+ | **220 ohm resistors x4** | ||
+ | |||
+ | Resistors limit or regulate the flow of electrical current in an electronic circuit. Too much current going to the LED can cause the LED to burn out as LEDs will take as much current as you give them, but not without a price. Limiting the current to the LED bulb using a resistor ensures that we supply enough current to light the bulb without supplying too much current burning out the bulb. | ||
+ | |||
+ | **Jumper leads** | ||
+ | |||
+ | Jumper leads are wires used to connect to the load components (LEDs) to the GPIO BCM pins. | ||
====CIRCUIT==== | ====CIRCUIT==== | ||
Line 37: | Line 65: | ||
You are after a circuit that drives four LEDs, each one from a unique GPIO pin. | You are after a circuit that drives four LEDs, each one from a unique GPIO pin. | ||
+ | ===FOUR LED=== | ||
+ | |||
+ | You will want to identify 2 additional GPIO pins (The example program has BCM 17 and 18 already included to run as an output) and you can identify the wiringpi pin number/BCM number by using | ||
+ | |||
+ | yourpi:~$ gpio readall | ||
+ | |||
+ | This will give you what your machine has for GPIO' | ||
=====SPECIFICATIONS===== | =====SPECIFICATIONS===== | ||
=====PI SETUP===== | =====PI SETUP===== | ||
+ | |||
+ | NOTE: As of 20220908, is not working for the pi 400. See the section below for the pi 400 workaround. | ||
+ | |||
+ | First, we need to download the wiringPi library package: | ||
<cli> | <cli> | ||
- | wget https:// | + | yourpi: |
</ | </ | ||
+ | |||
+ | Then, we need to install it: | ||
+ | |||
+ | <cli> | ||
+ | yourpi:~$ sudo dpkg -i wiringpi-latest.deb | ||
+ | </ | ||
+ | |||
+ | ====wiringPi on the pi400==== | ||
+ | For the pi400, we have to do a slightly different process, but will result in the needed functionality becoming available. | ||
+ | |||
+ | On the pi (doesn' | ||
+ | |||
+ | <cli> | ||
+ | yourpi~$ git clone https:// | ||
+ | </ | ||
+ | |||
+ | Then: | ||
+ | |||
+ | <cli> | ||
+ | yourpi:~$ cd WiringPi | ||
+ | yourpi: | ||
+ | </ | ||
+ | |||
+ | Finally, build and install it: | ||
+ | |||
+ | <cli> | ||
+ | yourpi: | ||
+ | </ | ||
+ | |||
+ | Provided there are no apparent errors, close out of that terminal and open a new one, then the **gpio** tool and related WiringPi functionality should now be available. | ||
=====PROGRAM===== | =====PROGRAM===== | ||
+ | Declare | ||
+ | int cont = 0; | ||
+ | int num_cont = 8: | ||
+ | |||
+ | Make sure to record wiring pi assignments into pin array. Ex: | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | Remember to use if and else statements in while statement. Digital write goes after all if and else statements. Else uses LOW meaning off and if uses HIGH meaning on. | ||