I want to connect a switch to my arduino and the arduino will check the state of the switch and do different things in the void_loop() coding. How can I do this please explain as I'm totally a newbie (schematic of wiring + any code necessary)
What I have so far is a 3 pin switch so I connected one leg to Ground and one leg to +5V and the other leg to a digital pin. I heard you need a resistor in their somewhere (either 1k or 10k, depends on what I don't know) but I dont know where to put it. Also is my schematic correct?
Read this http://www.thebox.myzen.co.uk/Tutorial/Inputs.html
You only need a resistor with make / break not change over.
Code is simple a digitalRead(pin ) ; will return the value of what is connected to the pin.
Pin is a variable containing the number of the arduino pin you want to read.
I can't use a pushbutton I need an actual switch because I'm using the switch for this:
I have an automatic system that uses motors to do something and they rely on sensors and whatnot to function automatically. Sometimes the sensors mess up so I want to put the system into manual override and then use some other buttons and switches to do the tasks manually. So i need this switch to tell the arduino to keep in automatic mode or manual mode so it can't be push button unless you can use a pushbutton in this situation...