LAB1-Control LED with a momentary switch
1.Button 3A
Uploaded the code to the breadboard. I can turn on the LED by pressing the button but the LED did not consistently turn on and off.
2.Button 3B
Edited the code below and detected the change.
if ((val == HIGH && (old_val == LOW)) {
state = 1 - state
3.Button 3C
Improved the code agian-adding a 10 second delay.
The LED can turn on and off consistently!