pin not declared error

hi lads looking for a bit of advise hear. I keep getting errors hear. I was getting one saying that pins have no value. but that seams to be gone now. I cant seam to get rid of the error I have left witht he brackets. can any one help thanks

void setup()
{
int pinOUT = 7;
int pinA = 8;
int pinB = 9;
}
{
pinMode(pinOUT,OUTPUT);
pinMode(pinA,INPUT);
pinMode(PinB,INPUT};
}
void loop() {
// put your main code here, to run repeatedly:
boolean pinAstate - digitalRead(pinA);
boolean pinBstate = digitalRead(pinB);
boolean pinOUTPUTstate;
// and
pinOUTstate = PinAstate & pinBstate;
digitalWrite(pinOUT,pinOUTstate);
}

my error reads
PinB was not declared in this scope

pinMode(PinB,INPUT};
...
...
  pinOUTstate = PinAstate & pinBstate;

PinB != pinB

PinAstate != pinAstate

 boolean pinAstate - digitalRead(pinA);
  boolean pinBstate = digitalRead(pinB);

There is a subtle difference between these two lines.

plus see notes

void setup()
{
  int pinOUT = 7;
  int pinA = 8;
  int pinB = 9;
} // end of setup
{  // dissassociated block starts here 
  pinMode(pinOUT, OUTPUT);
  pinMode(pinA, INPUT);
  pinMode(PinB, INPUT
}; // bracket followed by unnecessary semicolon
} // extra bracket
void loop() {
  // put your main code here, to run repeatedly:
  boolean pinAstate - digitalRead(pinA);
  boolean pinBstate = digitalRead(pinB);
  boolean pinOUTPUTstate;
  // and
  pinOUTstate = PinAstate & pinBstate;
  digitalWrite(pinOUT, pinOUTstate);
}

Plus, your local variables declared in setup() will be destroyed once setup() ends, make them Global so that they can be used in loop().

thanks for the help. but I still cant get it to work. I am new to this programing so don't have much about it yet.
I changed the program around a bit and that has seam to got rid of the error I had. but now I am getting one that says pinOUT, pinA and pinB ware not declared in this scope.

int pinOUT = 7;
int pinA = 8;
int pinB = 9;
void setup()
{
pinMode(pinOUT, OUTPUT);
pinMode(pinA, INPUT);
pinMode(PinB, INPUT);
}

void loop() {
boolean pinAstate = digitalRead(pinA);
boolean pinBstate = digitalRead(pinB);
boolean pinOUTPUTstate;
// and
pinOUTstate = PinAstate & pinBstate;
digitalWrite(pinOUT, pinOUTstate);
}

boolean pinAstate = digitalRead(pinA);
  boolean pinBstate = digitalRead(pinB);
  boolean pinOUTPUTstate;
  // and
  pinOUTstate = PinAstate & pinBstate;

That doesn't compile.

C and C++ ARE case sensitive.

PinB is a different variable to pinB. The difference is the "P".

Once you get more used to reading C code, you will more quickly recognize "!=" as meaning "does not equal".

o right. never knew that at all. thanks for the help.

Just a quick tip from one new user to another, C programming is completely case sensitive, so if you name something "PinA" in one part of your program you must use that EXACT name throughout the program. I haven't yet tested it but I believe you could have PinA, pinA, and Pina as separate names in the same function as long as they had all been declared in the Setup.

Kiwi_Bloke:
Just a quick tip from one new user to another, C programming is completely case sensitive, so if you name something "PinA" in one part of your program you must use that EXACT name throughout the program. I haven't yet tested it but I believe you could have PinA, pinA, and Pina as separate names in the same function as long as they had all been declared in the Setup.

You could, but you really shouldn't

And if declared in the Setup, they could only be used in the Setup. (Redux.)
--Michael

One good way I had of obfuscating BASIC programs after they had been developed and were ready for distribution, was to run the code through a program that changed the name of all variables into one word but with a mixture of upper case and lower case letters to make them different.
It was impossible to read the code but it ran just fine.

Grumpy_Mike:
One good way I had of obfuscating BASIC programs after they had been developed and were ready for distribution, was to run the code through a program that changed the name of all variables into one word but with a mixture of upper case and lower case letters to make them different.
It was impossible to read the code but it ran just fine.

"C Journal" or whatever name they changed to used to have "obfuscated code " contest.
Maybe this forum should have one once a while.
I suppose the contest entries would have to be enclosed in code quotes to qualify.
Bummer , that leaves me out.

Seriously - how about "sticky / or stickie ?" on most common C coding errors?

  1. C / C++/ C# is case sensitive
  2. C / C++/ C# commands terminate with semicolon ";"
  3. Code without comments is like day without a sunshine
  4. Code without comments may keep your job longer or very short.

Vaclav:
"C Journal" or whatever name they changed to used to have "obfuscated code " contest.
Maybe this forum should have one once a while.
I suppose the contest entries would have to be enclosed in code quotes to qualify.
Bummer , that leaves me out.

Seriously - how about "sticky / or stickie ?" on most common C coding errors?

  1. C / C++/ C# is case sensitive
  2. C / C++/ C# commands terminate with semicolon ";"
  3. Code without comments is like day without a sunshine
  4. Code without comments may keep your job longer or very short.
  1. Code with incorrect comments is misleading
  2. Code with comments that echo the code is utterly pointless