Debounce Input Signal

Medium C IO
Solve this problem

Debounce a digital input signal using a simple counter method.

Constraints

  • Function prototype: int debounce(int raw).
  • Stabilization time: 5 samples.
  • Output state stored statically.
  • Count increments only on consistent reads.
Starter codeC
1int debounce(int raw){2  //Your Code 3 4}