Thanks so much for the great responses. Sorry for the delay in responding–I just wanted to wait until I had the quality time to sit and study this and everything y’all said. Also, I thought I’d come to understand it, so I wanted to run an experiment to test my theory–which turned out to be wrong. I’d like to ask y’all each questions about your responses individually, but first please take a look at what I did, which may help to explain my state of complete newbie-ness
I thought the pullout resistor existed to ensure that only a LOW signal got sent to the pin. So I figured, okay, I’ll replace the pullout resistor with a straight wire connection to the 5v power, and I changed all the “LOW”'s in this code to “HIGH”:
if (((button1State == HIGH) || (button2State == HIGH)) // if we're pushing button 1 OR button 2
&& ! // AND we're NOT
((button1State == HIGH) && (button2State == HIGH))) // pushing button 1 AND button 2
// then...
{
//this part I left as HIGH, of course.
digitalWrite(ledPin, HIGH); // turn the LED on
Well, it did work, but what’s weird is I changed the code before removing the pullout resistors, and it STILL WORKED.
So I think I’m wrong, but I’m not sure how I’m wrong
Questions (if it pleases you to answer them):
@Watr: Your suggestion sounded wonderful, so I got out my DMM and promptly discovered that I was even more of a newb than I realized. Care to give some more detailed (novice) guidance? On the Ohm part of the multimeter, I have the choices to set the dial to 2000k, 200k, 20k, 2000, or 200. How do I know which one to use? I tried 200 and when I put the red on the 5v side of the switch, and the black on the grounded part, the light came on. It didn’t when I had it set to 2000k. I’m pretty sure that means something, but I’m not sure what. After you’re done laughing, I’d LOVE to understand this better.
@CircuitBurner: I’m having trouble grasping how the switch can have three states. It’s closed, or open, right? How can it be three? That being said, I’m heavily pondering your analogy about the spring on the toilet flapper, and in fact that’s what prompted me to do the experiment above.
@Valen: the safety aspect is one I hadn’t considered, and is very good information. I shall have to program carefully :-). Is that the only reason though? The other stuff I’ve read seems to suggest it’s not just a simple safety issue. Or am I thinking one thing is two different things?
Any further feedback would be greatly appreciated! I’m sure I can do this!
lee