Push button circuit setup

For this exercise, we will need:

  • 4-pin push button: A push button is an electronic component that is attached to two points in a circuit. It is also called a tact switch. When it is pressed, it joins these two points and the circuit is completed. The circuit is disconnected when the button is not pressed.
  • Male-to-male jumper wires: We need jumper wires to connect BeagleBone and components through a breadboard.
  • Half-size breadboard: A breadboard is needed to create a solderless circuit.
Push button circuit setup

Power off the board and attach the components to BeagleBone as shown in the preceding diagram.

Circuit analysis

Let's see the analysis step by step:

  1. The 4-pin push button is divided into two sides. Within the first side, pole 1 and pole 2 are already connected. Another side has pole 3 and pole 4 connected. But these both sides are not connected to each other. When the button is pressed, the pole 1 and pole 2 side gets connected to the pole 3 and pole 4 side.
  2. Pin P9_3 and P9_4 are not regular GPIO pins but provide continuous 3.3 voltage. They are useful to provide voltage to electronics components. Here, we apply 3.3V to pole 4 and the current is stuck there until the button is pressed. Once the button is pressed, pole 4 is connected to pole 1. We have joined pole 1 to P8_16, which is in input mode. The circuit get completed and current starts flowing from P9_3 to P8_16. If we read pin P8_16 now, we will get the value HIGH.
  3. When we release the button, pole 1 and pole 4 are disconnected and the circuit gets broken. Now, if we read pin P8_16 from our program, we will get the value LOW. In our program, we will print whatever value we find.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.137.38