I'm really new to programming so bear with me. I have my program running exactly how I want it to. All I'm trying to do now is add a sort-of deadman switch that stops the loop if it is not depressed. Basically there's a tray with a limit switch on it. If the tray is pushed in, the program will run as normal. If it is not pushed in, the loop will not run. Everything I've searched for so far has been slightly different than I want and since I'm new to this, I don't know how to make that conversion.
Oh, and to clarify, I don't want the power cut to the board. If I wanted that I would just run the power supply through the switch. I only want the loop stopped. It seems like it would be a simple thing, but I'm just not finding it. Please help.
Actually, I might have just thought an "analog" way of doing this. This thing I'm making has a momentary button that when pressed starts the loop. I can just run this button through the limit switch so that the button can't start that loop unless the tray is pushed in.
But then it would no longer be a dead man switch, as the loop will run after the button has pressed and your switch would no longer affect it. It may work for your application, but it does show your description of the desired functionality isn't complete.