C language to implement microcontroller breathing light

Yuxian: CSDN content partner, CSDN rising star mentor, rising star creator in the full stack field, 51CTO (Top celebrity + expert blogger), github open source enthusiast (go-zero source code secondary development, game back-end architecture https: //github.com/Peakchen)

1. The status light D1 flashes at a frequency of 2Hz;
2. After pressing button 1 (customized), D2 runs the breathing light, and the frequency is not limited;
3. After pressing button 2 (customized), it stops requiring 2 breathing lights, D2 -D8 starts running
the running water lamp, the frequency is not limited;
4. Press button 1 (customized) again to stop the running water lamp and start the breathing lamp;
5. Requirements 1, 2, and 3 to be completed at the same time

Function explanation:

  1. The status light D1 flashes at a frequency of 2Hz: a cycle is used to control the on/off status of the status light, and each cycle uses a delay function to achieve a certain time interval to control the flashing frequency.
  2. After pressing button 1, D2 runs the breathing light with no limit on frequency: through the interrupt processing function, when button 1 is pressed, the flowing water light effect is stopped and the breathing light effect is entered. The breathing light effect is achieved by increasing the brightness and adjusting the fadeAmount value.
  3. After pressing button 2, the breathing light stops, and D2-D8 starts running the running water light. The frequency is not limited: through the interrupt processing function, when button 2 is pressed, the breathing light effect is stopped and the running water light effect is entered. The running water light effect is realized through counter and corresponding pin status control.
  4. After pressing button 1 again, the running water light will stop and the breathing light will start: through the interrupt processing function, when button 1 is pressed again, the running water light effect will be stopped and the breathing light effect will be re-entered.

Guess you like

Origin blog.csdn.net/feng1790291543/article/details/132894549