I have connected my arduino to a button and when I press it the whole thing powers off, I am a total noob pls help
Sounds like you're shorting the power supply.
Please describe how your switch is wired.
You have connected it incorrectly and are probably shorting out the power to the board when you press the button
Please post a schematic of your project and your code
Sorry but I cannot make any sense of the picture
Hi,
Can you please post a picture(s) of your project so we can see your component layout?
What button are you using?
What model Arduino?
If you can, please DRAW a circuit diagram with pen(cil) and paper and post an image of it.
Thanks.. Tom....
I Am Using Uno R3
And Cheap Button From Amazon
I Have plugged ground and 5v into input of button and d7 as output.
Your drawing has no pin numbers on it which makes interpreting it difficult
In the video you have connected wires to 3 out of the 4 pins of the button. Do you know which ones become connected when the button is pressed ?
Note that you can insert the button into the breadboard 2 ways at right angles to one another and that makes a great deal of difference. I suggest that you do nothing until you know which pin on the button does what when pressed and not pressed
Why is pin 7 an output when what you want to do is to use it as an input to read the state of the button ?
It looks like you are shorting GND and 5V when you press the button
Thanks, When I Put d7 output I meant from button. Also when I take out ground it dosent power off, also I dont know what the 4th pin on the button does how do I stop It Shorting?
Hello
Take an Ohmmeter and check how the button is operating.
Sorry I Dont Have One
What not to understand? button is between 5v and ground
So Have I Wired It Wrong?
sure
It seems to me that you don't know what the other 3 do either. Do you know which ones are shorted when the button is pressed ?
I wish that I had your insight as to what the drawing shows.
For instance
of the 4 pins on the button which ones are being used here ?
In the picture it looks like 5V and GND may be shorted whether or not the button is pressed, but we know that the problem only occurs when the button is pressed so that can't be true
FWIW my original diagnosis of the problem was
it is a symbol for a momentary button, schematics may not contain pin numbers
So it is what it seems, a useless schematic
These tact buttons are a real nuisance if you don't know what you are doing. They look symmetrical but aren't and the orientation in which they are used matters.
Personally, when I use them on a breadboard I connect a single pair of jumpers to diagonally opposite pins which ensures that they are connected to a pair of normally open contacts. This is not always convenient on PCBs and it is sometimes an advantage that pairs of pins are connected internally in the switch, but I am very careful when laying out the PCB to ensure correct orientation of the switches
same
So which are the diagonally opposite pins in the diagram in post #16 ?