You seem to need to know when the button becomes pressed and when it becomes un-pressed. Do you have pin A2 coded as input PULLUP?
Please include you code.
Paul
It matters not where you got the code, if you want help with it we need to see it. Read the forum guidelines to see how to properly post code. Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Tell us what the code actually does and how that differs from what you want.