title: Dynamically switch between programs Arduino
body: <p>I have a question regarding how to use a mechanical switch to change programs in an Arduino unit. I am currently making a wireless follow focus device that will use xbee to connect to another Arduino unit with a potentiometer to rotate a servo wirelessly (program 1). However, I also want the option to plug a simple backwards and forwards button into the main unit (program 2). Therefore I need some way to switch between the two programs. </p>
  
  <p>I am looking for the most elegant way of doing this. An optimal scenario would be that once the buttons are plugged in the code automatically switches to the button mode (program 2). However, I am not sure how to accomplish this.</p>
  
  <p>I would much prefer a mechanical switch if the latter is not possible. However:</p>
  
  <p>I thought that it may be possible to have a program that waits for an input be it a push of button 1 that will then switch to the program logic of program 1, or button 2 triggers program 2.</p>
  
  <p>Im interested to know if any of my ideas hold merit, and what is the most elegant solution you can come up with. Because I'm stumped.</p>