JalalSayed1 / Switch-debounce

To investigation switch bouncing and to cope with it in mbed - FRDM-KL25Z.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Switch bounce

About the project:

  • To investigate switch bouncing and to cope with it in mbed - FRDM-KL25Z.
  • While a switch from the outside world bounces many times when clicked/pushed, our ucontroller will only react to it when it settles on a steady-state.
  • I used flags to define if the switch is still bouncing or not over time intervals of 2ms.
  • Tflag: Time flag, will be set when the time interval of 2ms has expired.
  • SWflag: Switch flag, will be set when Tflag is set up and switch is not bouncing anymore.

Flags rising flowchart:

image

What did I learn from it:

  • Using Timers in mbed.h.
  • Finding out the count of a changing event over time periods in C++.
  • Printing messages from ucontroller to "Terraterm" on PC.

Final result:

  • Blue trace: From the switch directly.
  • Yellow trace: Our ucontroller reaction to the switch.

20220303_155946

VID-20220303-WA0004.mp4

About

To investigation switch bouncing and to cope with it in mbed - FRDM-KL25Z.


Languages

Language:C++ 100.0%