I'm am a total newby. Know my way around computers but have no clue about electronic stuff. My first "project" was a simple buzzer with a button.
I connected the (passive) buzzer (+) on pin 13 and ground.
And the button on 5v, pin 2 and ground with a 10k resistor between button and ground. A straight forward schema I found here for using a button.
I cut an paste and adapted some code. Pushed the button and voila...a great buzzing sound off which I could control the pitch by adapting te sketch code.
So far so good....
But I discovered when I hold the push button the resistor heats up to a point that it starts to smoke and burn.
You need a higher power dissipation rated resistor, like 1/2W vs the small 1/8W part you're likely using, or a higher value resistor to let less current flow so the resistor does not have to dissipate so much power.
Anyway, the better way to wire a button to an Arduino is to wire it between your selected pin and ground and use the built in pull-up resistor e.g.: pinMode(2, INPUT_PULLUP);
That way you don’t need the “10k” resistor.
However, you have to invert the logic in your sketch because the pin is now “LOW” if the button is pressed.
Incidentally, What colors do you see on the resistor?
fdqvdm:
But I discovered when I hold the push button the resistor heats up to a point that it starts to smoke and burn.
Any ideas on what I am doing wrong?
Kind regards,
Floris
First idea is ...... ensure that the component that you're using is really what it is. So if 10 kiloOhm resistor is being used, then use a multimeter (in resistance measurement mode) to measure the resistance, to ensure that the resistor is really ten thousand ohms. Alternatively, if the colour code indicates 10 thousand ohm, then that will help a lot as well.
I realize you haven't had a chance to reply to the other suggestions, but I'll add my 2¢.
If you plan on working in this area you should consider a DVM if you don't already have one. It would then be simple to double check the resistor value.