A key switch module is a push button device that would provide an output HIGH signal when the button has been pressed. The module contains a tactile push button switch and a resistor.
Connection Connect the "-" pin to GND of Arduino, the middle pin to 5V of Arduino, and the "S" pin to any digital pin of Arduino. In our code example, the "S" pin is connected to digital pin 4 of Arduino.
Upload the code and test the module. The LED should turned on when the button has been pressed, and turned off when it is not pressed.