A small point about this thread. The switch in the photograph is not a "limit" switch, it is a single pole changeover microswitch. Whilst it is true that such switches are often used as limit switches but they are not limited (sorry) to such use and a limit switch could be any type of switch operated at the limit of movement of some kind of mechanical component to stop its movement at that point.
UKHeliBob:
A2 is a digital pin when used correctly.
A small point about this thread. The switch in the photograph is not a "limit" switch, it is a single pole changeover microswitch. Whilst it is true that such switches are often used as limit switches but they are not limited (sorry) to such use and a limit switch could be any type of switch operated at the limit of movement of some kind of mechanical component to stop its movement at that point.
And the difference is how they are actuated. Some have a tiny push button. Some have a leaf like yours, but with a roller on the end and some are just like yours. The roller type may follow a cam and actuate at a certain cam rotation to time a function. Some, like yours, may be actuated by something with a range of contact point positions. And there are probably other designs.