Microcontroller 51 controls a key study notes of small light

  1. Today we learn about cases of SCM, in fact, small and light, as we do not stress, it is very simple.
  2. First, we create a project, if students forget, you can read my previous blog. Here is the link.
  3. https://blog.csdn.net/qq_40831778/article/details/102526533
  4. https://blog.csdn.net/qq_40831778/article/details/102525886
  5. 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 ;
  6. 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

  7. 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.

  8. We compile download programs, found a small light D1 does not light, then we press the button K1 , successful small lamp lights up.
  9. 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.

 

发布了45 篇原创文章 · 获赞 96 · 访问量 1万+

Guess you like

Origin blog.csdn.net/qq_40831778/article/details/102629380