I've attached a picture of the circuit in iCircuit (which works) but when I put everything on the Arduino (UNO) it doesn't work the way I expect.
I have 5V going through a 330 Ohm resister that goes into a lead of a push button. The other lead of the button goes into the + lead of an LED. The - lead of the LED goes directly into GND on the Arduino.
I expect the LED to be off by default and on when I push the button. But the LED is on all the time. (???)
I am totally new to electronics and I'm obviously doing something wrong.
I've attached a picture of the circuit in iCircuit (which works) but when I put everything on the Arduino (UNO) it doesn't work the way I expect.
I have 5V going through a 330 Ohm resister that goes into a lead of a push button. The other lead of the button goes into the + lead of an LED. The - lead of the LED goes directly into GND on the Arduino.
I expect the LED to be off by default and on when I push the button. But the LED is on all the time. (???)
I suspect that the problem is how you wired to the switch terminals. A lot of those small 'buttons' have four terminals but you must be sure you are not using two adjacent terminals that are direct connections to each other rather then switched to the other pair of contacts. This is why having a digital multimeter is so important to anyone starting off to learn to build electronic circuits. Using the ohm meter function of a multmeter can confirm that you understand which terminals will actually open and close a circuit as you manipulate the switch button. Anyway that's my best guess at the source of your problem. Lefty
I am totally new to electronics and I'm obviously doing something wrong.
Latency:
Thank you for your reply Lefty. I thought that might be the problem so I rotated the button 90 degrees. When I do that the LED never lights.
By the way, when you say "adjacent" do you mean the first or second layout below? (I don't have a multimeter yet)
1:
--| |-- (a)
--| |-- (b)
2:
(a)---- (b)
--| |--
--| |--
Thanks!
LT
I don't know what way I mean, that's why I always use an ohm meter first to find the terminals I need to use. Here is the problem, it's a simple SPST switch but there are four terminals. There is physically 6 different ways to attach two wires to four terminals, and only four of the possible ways will function correctly. So how lucky do you feel, punk? That's why I use a meter, as I hate to always rely only on my luck on any given day.
Lefty: you'll be happy to know that I just ran out and bought a digital multimeter. And yes, now I know which leads are connected.
Grumpy: In my original post I said
I expect the LED to be off by default and on when I push the button.
I also said
I have 5V going through a 330 Ohm resister that goes into a lead of a push button. The other lead of the button goes into the + lead of an LED. The - lead of the LED goes directly into GND on the Arduino.
I guess I should have been more clear... the 5V is connected directly to the Arduino's 5V pin.
If I remove the button the LED stays lit (as you'd expect).
A multimeter would be handy. Put it in continuity mode and check every pin combination and what it does when the switch is depressed vs. not depressed. Use whatever combination gives the switch as open (no continuity) if not depressed and closed (continuity) when pressed. If there are no two pins that show this behavior the switch is screwed.
Tact switches can be had for four cents each. You should own > 100 of them.
Lefty: you'll be happy to know that I just ran out and bought a digital multimeter. And yes, now I know which leads are connected.
Yes, that does make me happy, and happy for you also. I'm sure you will find the multimeter will help solve lots of other questions you might come across in the future. Life would be much simpler if those darn electrons were not invisible, but one has to except the good with the bad.
Lefty: you'll be happy to know that I just ran out and bought a digital multimeter. And yes, now I know which leads are connected.
Yes, that does make me happy, and happy for you also. I'm sure you will find the multimeter will help solve lots of other questions you might come across in the future. Life would be much simpler if those darn electrons were not invisible, but one has to except the good with the bad.
Lefty
Multimeters are logic probes are the two most useful tools most of the time and they are two of the cheapest. You can get a low end Elenco logic probe at Amazon or Frys for like $15 and I suggest that too. Low end doesn't mean low quality, just that it only has one function - the one you need (is the line or pin low, high, or disconnected?).
Well, since I am a total electronics noob (20 years as a software engineer and I never touched a resistor) :), iCircuit allows me to test out very basic things without having to wire stuff up. Or, I should say that it allows me to try stuff out in software before I do something bad in the real world.
I have no idea if it would be useful to someone who really knows what they are doing.
I usually take a wire , connect it to one side ( e.g. the LED in this most basic circuit ), and touch the other side ( in this case the unconnected resistor leg)
Buttons are far too complex with their4 pins; a wire (or two) is way more intuitive, you immediately see if the circuit is closed or not.
Sure, latest when it goes from breadboard to prototype soldering, a free flying wire is not recommended any more, and one should invest in a button ( being as expensive as a transistor, btw )
Handy tip for using the tactile switches. If you don't know how the switch is wired internally, just choose two pins at opposite corners of the switch. That pretty much gaurantees that you get the switch to work without having to check with a multimeter.