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
Содержание Ultimate Starter Kit
Страница 1: ...Free your innovation Freenove is an open source electronics platform www freenove com ...
Страница 116: ...Chapter 9 Potentiometer RGBLED 116 www freenove com support freenove com Circuit Schematic diagram ...
Страница 117: ...117 Chapter 9 Potentiometer RGBLED www freenove com support freenove com Hardware connection ...
Страница 136: ...Chapter 12 Joystick 136 www freenove com support freenove com Circuit Schematic diagram Hardware connection ...
Страница 155: ...155 Chapter 14 Relay Motor www freenove com support freenove com Hardware connection OFF 3 3V ...
Страница 173: ...173 Chapter 16 Stepping Motor www freenove com support freenove com Hardware connection ...
Страница 182: ...Chapter 17 74HC595 LEDBar Graph 182 www freenove com support freenove com Circuit Schematic diagram Hardware connection ...
Страница 197: ...197 Chapter 18 74HC595 7 segment display www freenove com support freenove com Circuit Schematic diagram ...
Страница 198: ...Chapter 18 74HC595 7 segment display 198 www freenove com support freenove com Hardware connection ...
Страница 239: ...239 Chapter 22 Matrix Keypad www freenove com support freenove com Circuit Schematic diagram ...
Страница 240: ...Chapter 22 Matrix Keypad 240 www freenove com support freenove com Hardware connection ...
Страница 270: ...Chapter 26 WebIOPi IOT 270 www freenove com support freenove com Circuit Schematic diagram Hardware connection ...