Using limit switch

Hi,
Welcome to the forum.
Please read the post at the start of any forum , entitled "How to use this Forum".

That will short your power supply out when the NO becomes closed.
You need;

A4 to COM
GND to NO
no connection to NC.

The pull_ups will provide the 5V.
Your A4 will be at 5V and go to GND when the limit switch is closed.

Tom.... :grinning: :+1: :coffee: :australia: