Key Switch Module KY 004 Working Principle

This type of button on the KY 004 Arduino module has four legs.The top two legs are joined, and the bottom two legs are similarly attached. When the top and bottom sections join, current flows, and this occurs when the button is pressed. When the connection between the two pieces is broken, the current flow will halt.

When you connect the module to the Arduino,  it senses the flow of current from the resistor  connected to the leg of the button, so the Arduino can tell if the button is pressed.


- Key Switch Module

- Arduino Uno/Nano


- 330 ohm resistor

Get Full Code for your IDE