65
Chapter 2 Button & LED
Project 2.2 MINI table lamp
We will also use a button, LED and UNO to make a MINI table lamp. But the function is different: Press the
button, the LED will be turned on, and press the button again, the LED goes out.
First, let us learn some knowledge about the button.
Debounce for Push Button
When a Push Button is pressed, it will not change from one state to another state immediately. Due to
mechanical vibration, there will be a continuous buffeting before it becomes another state. And the releasing-
situation is similar with that process.
Therefore, if we directly detect the state of Push Button, there may be multiple pressing and releasing action
in one pressing process. The buffeting will mislead the high-speed operation of the microcontroller to cause
a lot of false judgments. So we need to eliminate the impact of buffeting. Our solution is: to judge the state
of the button several times. Only when the button state is stable after a period of time, can it indicate that the
button is pressed down.
This project needs the same components and circuits with the last section.
Ideal state
Virtual state
press stable release stable
Summary of Contents for Ultimate Starter Kit
Page 1: ...Free your innovation Freenove is an open source electronics platform www freenove com ...
Page 117: ...117 Chapter 9 Potentiometer RGBLED www freenove com support freenove com Hardware connection ...
Page 155: ...155 Chapter 14 Relay Motor www freenove com support freenove com Hardware connection OFF 3 3V ...
Page 173: ...173 Chapter 16 Stepping Motor www freenove com support freenove com Hardware connection ...
Page 239: ...239 Chapter 22 Matrix Keypad www freenove com support freenove com Circuit Schematic diagram ...
Page 240: ...Chapter 22 Matrix Keypad 240 www freenove com support freenove com Hardware connection ...