Single Switch Multiple Functions
Introduction
In this project, I am going to teach you how to give multiple functions in a single push switch. Below is the list of different ways of using the switches for different functions,
- Single Tap
- Double Tap
- Triple Tap
- Four Tap
- Hold
- Tap and hold
Demo
Things Required
- Arduino or any other compatible board
- Micro push button
- RGB LED, for testing the switch functions.
Theory
- First, we calculate the time gap between each button press and the number of times the button is pressed
- Then according to the no. of times, the button is pressed we are calling different functions
- like the same way if the time gap is more than the preset value then we consider it as a "hold" and we call the functions which we associate to it
watch the full video for detailed programming instructions.
Circuit
- Connect one leg of the push button to any digital pin.
- connect the other leg to the ground of Arduino.
Full Video
Part 1
Part 2
Code
Single Switch Multiple Functions
Reviewed by Abu Yazid
on
April 25, 2019
Rating: