50. LED Patterns Switching

Design a task to switch between two LED patterns using a push button

Also, consider the following condition

  • An important task is continuously running in a  void loop(). It needs to be executed continuously, and cannot be altered or changed. 

Your void loop() should be as given below.

void loop() {
  while (true) {
    //In this loop Microcontroller is busy in monitoring and performing   important tasks constantly.
  }
}

 

Requirements

  • Main Loop: Must remain unchanged and execute critical tasks continuously.
  • Button Detection: Detect every press, even quick/repeated ones, to switch LED patterns.
  • Debouncing: Handle switch bouncing effectively.
  • Interrupts: Use ISR to detect button presses without disrupting the main loop.
  • LED Patterns: The two LED patterns must be as shown in the GIFs below.
     

 

 

Submit Your Solution