Lab 3 - Button Control Challenges


 

Mandatory Challenges

Part 1:

Make a circuit with 4 LEDs and 2 pushbuttons that does the following:

1. When one button is pressed, all even LED's will turn on for 0.5 seconds then go off.

2. When the other button is pressed, all odd LED's will turn on for 0.5 seconds then go off.


Part 2:

Keep the same circuit but make a program that will turn on the LED corresponding to the number of times you pushed one button after you push the other button.

In other words:

-Button A will keep track of the number of times it is pushed

-Each time button A is pushed, it will go on for 0.5 seconds to acknowledge it has counted once

-Button B will light the corresponding LED according to how many times Button A was pressed

-After the LED is on for 0.5 (delay time) seconds, the program resets and you can push Button A to equal which LED you want on

-If Button A is pressed more than 4 times, all the lights wil go on

-If Button A is not pressed when Button B is pressed, no lights will go on, instead the program will wait the delay time (not allowed to output to an unused pin...you must program for a delay)

Example:

Button A is pressed twice: (Button A is pressed, LED #1 goes on for 0.5 seconds, Button A is pressed again, LED #1 goes on for 0.5 seconds)

Button B is pressed and LED #2 goes on for 0.5 seconds

Button A is pressed once

Button B is pressed and LED #1 goes on for 0.5 seconds

Hint:

 Lab 3 - Mandatory Challenge - Part 2 - Hint


Part 3:

Modify Part 2 so that the counter only goes up if both Button A AND Button B are pressed!