Connect hardware switch to Arduino board

I already tried to find information on this topic, but I’m probably using the wrong search terms since I couldn’t find the information I need.

The question is basic. I have an on/off switch that I want to use to let my Arduino Nano send data through the TX pin hole. The easy solution would of course be to let the switch control power to the Arduino itself but that would mean that the Arduino would have to boot each time I switch it on which would take a couple of seconds before it could start sending commands through the TX pin.

So I probably want the Arduino Nano to be powered on all the time (5V input connected to power source), but as soon as I turn the switch to “On”, it would immediately start sending commands through the TX pin. This means the switch connections need to be placed somewhere between the Arduino pins and not “in front of” the Arduino.

I need advice both on how to connect the hardware, i.e. a wiring diagram, but also how to control this in the Arduino software. How do I detect the switch changing states?

This is how the switch looks like, and as a bonus, I would like to have the functionality of having the LED on the switch light up when I turn it on and vice versa.I assume I have to feed the switch with constant power and the switch will decide when to light up the LED as well as providing power back to the board to trigger the commands being sent.

Nano has pins, Uno has pin holes.

Nano can seat on a breadboard, connect to female jumper ends and some cable end connectors.

Uno connects to male jumper ends.

This address below is to Not My Site, Nick Gammon’s tutorial on switches. Get through that and save a lot of time and questions, the ones you’d have left should be good enough to get interesting answers.

http://www.gammon.com.au/switches