Connecting an Active Low switch to Arduino

Arduino Uno has a built in ‘pull up’ resistor integrated into its circuit. We can use this resistor by using INPUT_PULL as the mode argument for the pinMode function.

By writing pinMode( 2, INPUT_PULLUP), the pin 2 on the MCU has Vcc = 5v and a pull up resistor. Following is the diagram for active low.

Active Low switch, pin is low when switch is On

switch is off, pin 2 is High
Serial monitor show pin 2 is High
switch is closed, LED lights up as per code and pin 2 is LOW as current flow to external ground (Gnd).
Serial monitor shows LOW when switch is active (closed), hence Active Low.

Please note that the pull up resistor and the 5v Vcc is inside the Arduino Uno circuitry itself . By stating pinMode (2, INPUT_PULLUP) in the sketch, we are telling the MCU to provide 5v through the in-built pull up resistor via pin 2 to itself.