CIRC-07 Fading

Answers, please?

You need to start with a really simple setup and a really simple sketch.

Wire one side of the switch to ground. Wire the other side to a digital pin. Let's use 7. Then, try this code:

const int swiPin = 7;

void setup()
{
   pinMode(swiPin, INPUT);
   digitalWrite(swiPin, HIGH); // Turn on pullup resistor

   Serial.begin(115200);
}

void loop()
{
   if(digitalRead(swiPin) == LOW)
   {
      Serial.println("Switch on 7 is pressed...");
   }
   else
   {
      Serial.println("Switch on 7 is released...");
   }
   delay(100);
}

Untested and uncompiled, since I'm moving to a new computer, but I think this will work.

Verify and upload, then open the Serial Monitor. The message about the switch being released should print 10 times per second (as long as the baud rate for the Serial Monitor is set to 115200), until you press the switch. Then, 10 times a second, the message about the switch being pressed should be printed, for as long as you hold the switch down.

Try that, and let us know the results. If it works, or rather, when it works, wire in a second switch the same way, only use pin 8. Add more code to the sketch, to confirm that both switches work correctly. If you have problems, post the code.

When you know that the switches work, adding LEDs, etc. is easy.

Ok, I tried that. One button, two wires and the sketch monitor shows

"Switch on 8 is released..."

and if I hit the button again, it reads "switch on 8 is pressed"

When I tried to add more code, when I added "const int swiPin = 7; there was an error: "redefinition on const int swiPin" is there a different place/way to type = ? And is there a book/manual for the code? thanks.

You can't have two entities in the same scope with the same name - call your new pin something else.

I am absolutely new; what do you mean? Thank you.

when I added "const int swiPin = 7; there was an error: "redefinition on const int swiPin"

You've already got something called "swiPin"; how is the compiler supposed to know which one you mean to use?

Post your code

const int swiPin = 7;

void setup()
{
pinMode(swiPin, INPUT);
digitalWrite(swiPin, HIGH); // Turn on pullup resistor

Serial.begin(115200);
}

void loop()
{
if(digitalRead(swiPin) == LOW)
{
Serial.println("Switch on 7 is pressed...");
}
else
{
Serial.println("Switch on 7 is released...");
}
delay(100);
}

I need to add a secondary button so see what the problem is. Both buttons should do the same thing; if I push one, the sketch should be the same as the other button.

So, invent another variable (maybe "swiPin1") , give it the pin number you intend to use, and duplicate the code you have now,.
Eventually, you'll discover arrays and you'll be able to have as many of these functions as you want.

Really, I can type anything for the cont int, etc? Seriously, I did Basic in 89 and FORTRAN in 91...I'm out of the loop. There should be a book for dummies

There should be a book for dummies

Perhaps some like "So, you're too stupid to learn C++?"

Seriously, if you can create two variables for similar purposes in one language, you can do the same in another language. In English, you might have swOne and swTwo. In Spanish, you might have swUno and swDos. In French, the might be swUne and swDeux.