question on the logic/approach using a slide switch?(any position on power up)

xl97:
For some reason.. I'm having a brain fart with wrapping my head around this... =(

I have a slide switch:
similar to this.. (but with only 3 legs instead of 6)
http://www.radioshack.com/product/index.jsp?productId=3020764

that I am using in a project...

it can set the 'project' to either semi-auto... or full-auto..

I have it playing a sound effect whenever it is toggled either way..

what Im having a problem with is... setting itup correctly I guess..

I currently just use an internal pull-up resistor for it, and have tried several attempts at the code for it..

its just that.. I'm a bit stumped with using an internal pull-up resistor.. but this slide switch can really be in any position upon start up..

after several attempts.. it either 'doesnt toggle' any more..

or 'always' plays the mode select audio file upon power-up (which I dont want)..

so Im unclear on how I can code/prepare for the slider the be in any position upon start up, still not having the switch be floating.. and NOT play the mode select audio file upon boot-up/power-up..

I hope that makes sense.. (kinda hard to explain)

thanks

It appears that you need something like this near the start of loop():

while(slideSwitch_not_moved){
check slideSwitch_setting;
} //do nothing until switch moved

so that it waits until the switch is toggled (at least once) before doing anything.