- Today we learn about cases of SCM, in fact, small and light, as we do not stress, it is very simple.
- First, we create a project, if students forget, you can read my previous blog. Here is the link.
- https://blog.csdn.net/qq_40831778/article/details/102526533
- https://blog.csdn.net/qq_40831778/article/details/102525886
- We first MCU elf generate a 10ms delay function, copy it to the project inside. If there is unskilled, you can see my previous blog, here is the link https://blog.csdn.net/qq_40831778/article/details/102623736 ;
- Then we define the pin, there is little light key pin, through schematic seen, a small lamp and the key pin, we type the following code
- Then we (1) which detects whether the key pressed while, i.e. whether a low state, in order to prevent not allowed to judge, we debounce delay is 10ms, after the detection of the key to see whether or low , or if low , we press the key indeed, we first small lamp lighting.
- We compile download programs, found a small light D1 does not light, then we press the button K1 , successful small lamp lights up.
- Finally, if I wrote the article really helped us a little favor, please do not hesitate to point a praise, if you want to learn together with my progress, you can focus on me, I QQ: 2992789432.