// Switch LED by Pushbutton in C and C++ // Recreated By Faisal // 22-March-2020 #include const int led = 3; const int button = 7; int PBval = 0; // reading pushbutton pin status int debounce = 300; int LEDval = HIGH; void setup() { // put your setup code here, to run once: pinMode (led, OUTPUT); pinMode (button, INPUT); PINA |= (1 << PINA7); // 1 to use internal pull-up resitor to pin A7, 0 to use external digitalWrite(led, LEDval); } void loop() { // put your main code here, to run repeatedly: PBval = digitalRead (button); if (PBval == LOW) { delay(debounce); LEDval = !LEDval; digitalWrite(led, LEDval); } }