Recall & Review
beginner
What is button debouncing in software?
Button debouncing is a technique used to ensure that only a single button press is registered when a physical button is pressed, by filtering out the rapid on/off signals caused by the mechanical bouncing of the button contacts.
Click to reveal answer
beginner
Why do mechanical buttons cause multiple signals when pressed?
Mechanical buttons have tiny metal contacts that physically bounce when pressed or released, causing the electrical signal to rapidly switch on and off for a short time before settling.
Click to reveal answer
intermediate
Name two common software methods to debounce a button.
1. Delay-based debouncing: Wait a short fixed time after detecting a press before accepting it.<br>2. State sampling: Check the button state multiple times over a period and confirm the press only if stable.
Click to reveal answer
beginner
What is the purpose of a debounce delay in software?
The debounce delay allows time for the button's mechanical bouncing to stop before the software registers the button press, preventing multiple false triggers.
Click to reveal answer
intermediate
Show a simple C code snippet to debounce a button using a delay.
#define DEBOUNCE_TIME 50 // milliseconds
int buttonPressed() {
if (readButtonPin() == PRESSED) {
delay(DEBOUNCE_TIME); // wait for bouncing to settle
if (readButtonPin() == PRESSED) {
return 1; // confirmed press
}
}
return 0; // no press
}
Click to reveal answer
What causes the need for button debouncing in software?
✗ Incorrect
Mechanical bouncing causes multiple rapid signals when a button is pressed, which software debouncing aims to filter.
Which of these is NOT a common software debouncing method?
✗ Incorrect
Using a hardware capacitor is a hardware debouncing method, not software.
What is a typical debounce delay time used in software?
✗ Incorrect
50 milliseconds is a common debounce delay to allow mechanical bouncing to settle.
In software debouncing, what should happen after detecting a button press?
✗ Incorrect
Waiting and checking stability prevents false multiple presses caused by bouncing.
Which function is commonly used to implement a delay in embedded C for debouncing?
✗ Incorrect
delay() or _delay_ms() functions pause execution to allow bouncing to settle.
Explain in your own words why button debouncing is necessary in embedded systems.
Think about what happens inside a button when you press it.
You got /4 concepts.
Describe a simple software approach to debounce a button press and why it works.
Consider waiting a short time before confirming the button press.
You got /4 concepts.