As you can see, there are several different methods to do what you want, each with different characteristics. How fast a response do you kneed? That is, does the uC need to see a signal the instant AC is present, or is a short delay acceptable. For example, the relay method will energize and release within about 1/10th second of when the switch is pressed and released. The signal from a 5 V wall wart will activate a little slower, maybe 1/2 second, but might release much slower, like a few seconds.
ak