Core Concept

Overview

Summary

Connections

Used in 1 Design Challenges

Used in 3 Guided Projects

 

Instructions

Parts List

  • myDAQ/myRIO
  • Pushbutton Switch
  • 1 220 ohm Resister

Learn It










1 Switch Count

Smiley face
Connect the Pushbutton switch as indicated in the circuit diagram to the left.
The myDAQ Digital I/O lines register a true as a signal above 2V and a false as below 0.8V.

2 Switch Count

Open the Button Press Count.vi found in the Push Button switch folder. Run the VI and start pressing your button. Explore what happens when you start pressing the button rapidly. Press and hold the button and see how the code reacts.

Are there cases where using falling instead of rising edges to count presses may be beneficial?

3 Switch Count

Examine the Block Diagram of the Push Button Count.vi. The main body of the code runs within
a while loop, so that the push button’s state can be updated indefinitely as the code runs. The
main code is a series of digital reads, which read the digital state of several different I/O pins.

What would happen if only “changes in state” were used to count, rather than rising or falling edges?

1 Switch Bounce

Smiley face
Wire your pushbutton switch according to the circuit to the left with AI0 of port C. This wiring configuration is implementing a pull down resistor approach which pulls the analog line low when the button is not pressed and pulls it high when the button is pressed.

2 Switch Bounce

Open the Switch Bounce Demo from your project, the numeric indicator on the left shows a running update of the voltage level read from the analog input. The graph will show the final update once the VI has been stopped. Run the VI and press the pushbutton a few times then stop the VI to see the graph output.

Explore the pull up resister configuration, discuss what the voltages and currents are of the output when the button is both pressed and not pressed.



Bootstrap Slider

Build It

Click on the hardware that you have to get specific instructions.

Resources

Downloads

  • React!

    Push Button Switch.zip