Introduction

  • Connections
  • Example

(30 minutes)


Connections

The push-button can be considered as a normally open switch, which closes for as long as we have pressed it. Logical “0” and “1” can be created from the push-button with the appropriate wiring.





The digital input reads “1” as long as the push-button is not pressed.

As long as the switch is pressed the input will read “0”.







The digital input reads “0” as long as the push-button is not pressed.

As long as the switch is pressed the input will read “1”.





Mechanical parts, such as switches and push-buttons, cause the digital input signal to bounce.

These bounces result in the input going back and forth between logical “0” and “1” for a short period of time.

To avoid bounces, an easy and quick solution is to freeze the program for a few milliseconds (approximately 25ms).