Momentary switch
From bildr
Hooking it up
To use one of these with an MCU, the best way is to connect one side of the switch to an input pin on the MCU and the other side to ground, then connect that same pin through a resistor to +v.
With a 5 volt MCU a common 10k-ohm resistor will work fine.

Code
For a push to make switch with the configuration above the input pin will be high when it is not pressed and low when it is pressed.
This page is a Component on bildr. Components are pages about specific parts, and include connection details and code when available.