Error message not with the code?

Hi people,
I'm not really much of a software person, and having this problem is sort of confusing.

Here is the code I have:

/*****************************************************************************/

#define buzzer PB1 //pwm pin
#define button PB2 // analogReadpin
#define latchPin PB0
#define clockPin PB4
#define dataPin PB5

void setup(){
  pinMode(buzzer,OUTPUT);
  pinMode(button,INPUT);
  pinMode(latchPin,OUTPUT);
  pinMode(clockPin,OUTPUT);
  pinMode(dataPin,OUTPUT);
}

void loop() {
  int state = analogRead(button);
  //A1
  if (state == 1023){
    digitalWrite(latchPin, HIGH);
  }  
  //A2
  if (state == 630 || state == 631 || state == 632){
    digitalWrite(latchPin, HIGH);
  }
  //A3  
  if (state == 433 || state == 434){
    digitalWrite(latchPin, HIGH);
  }
  //A4
  if (state == 245 || state == 246 || state == 247){
    digitalWrite(latchPin, HIGH);
  }  
  //B1
  if (state == 875 || state == 876 || state == 877){
    digitalWrite(latchPin, HIGH);
  }
  //B2
  if (state == 570 || state == 571 || state == 572){
    digitalWrite(latchPin, HIGH);
  }
  //B3
  if (state == 403 || state == 404 || state == 405){
    digitalWrite(latchPin, HIGH);
  }
  //B4
  if (state == 235 || state == 236){
    digitalWrite(latchPin, HIGH);
  }  
  //C1
  if (state == 792 || state == 793 || state == 794 || state == 795){
    digitalWrite(latchPin, HIGH);
  }
  //C2  
  if (state == 534 || state == 535 || state == 536){
    digitalWrite(latchPin, HIGH);
  }
  //C3  
  if (state == 384 || state == 385 || state == 386){
    digitalWrite(latchPin, HIGH);
  }
  //C4  
  if (state == 228 || state == 229 || state == 230){
    digitalWrite(latchPin, HIGH);
  }
  //D1  
  if (state == 729 || state == 730 || state == 731){
    digitalWrite(latchPin, HIGH);
  }
  //D2  
  if (state == 503 || state == 504 || state == 505){
    digitalWrite(latchPin, HIGH);
  }
  //D3  
  if (state == 368 || state == 369 || state == 370){
    digitalWrite(latchPin, HIGH);
  }
  //D4    
  if (state == 222 || state == 223 || state == 224){
    digitalWrite(latchPin, HIGH);
  }
  else{}
}

basically I'm using a matrix to read analog values from a button with only one pin. once it reads a value it will shift out a certain LED. For now I have the latchpin writing an LED high just to see if it works.
the values have a range, so I'm using ||.

The error I get:

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Stream.h:26,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/HardwareSerial.h:28,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:193,
                 from quizbowl.ino:20:
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Print.h:32:1: warning: "BIN" redefined
In file included from c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/iotn45.h:38,
                 from c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/io.h:282,
                 from c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/pgmspace.h:82,
                 from C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:8,
                 from quizbowl.ino:20:
c:/program files (x86)/arduino/hardware/tools/avr/lib/gcc/../../avr/include/avr/iotnx5.h:55:1: warning: this is the location of the previous definition
In file included from quizbowl.ino:20:
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:111: error: expected ',' or '...' before numeric constant
C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino/Arduino.h:112: error: expected ',' or '...' before numeric constant

"error compiling"
I'm using an attiny45 if that helps.
I tried adding the if statements one at a time. I did three of them and there was no problem, so I think the problem is not with the || statements
I'm not sure because it is my first time using || statements. I read this: formatting - Best way to format if statement with multiple conditions - Stack Overflow

i also tried this:

if (a == 1 || a ==2 || a==3)

or

if ((a == 1 || a ==2) || a==3))

I'm confused.

It would appear that the names "dataPin" and "clockPin" are used by Arduino libraries.

Change them to something else and your code will compile. (It's nothing to do with your use of the || symbol)

Pete

Well I get a different set of error messages from that code are you sure you pasted the right code / error message?

What I get when I compile your code is that this bit is wrong.

#define buzzer PB1 //pwm pin
#define button PB2 // analogReadpin
#define latchPin PB0
#define clockPin PB4
#define dataPin PB5

Basically you have not defined what PB1 to PB5 actually are.

There is nothing wrong with the || but the whole code is very badly written and probably won't work.

el_supremo:
It would appear that the names "dataPin" and "clockPin" are used by Arduino libraries.

Change them to something else and your code will compile. (It's nothing to do with your use of the || symbol)

Pete

Thanks pete! I used shift registers with attinys (attinies?) before, and it seems like the library is supported Index of /

Grumpy_Mike:
Well I get a different set of error messages from that code are you sure you pasted the right code / error message?

What I get when I compile your code is that this bit is wrong.

#define buzzer PB1 //pwm pin

#define button PB2 // analogReadpin
#define latchPin PB0
#define clockPin PB4
#define dataPin PB5



Basically you have not defined what PB1 to PB5 actually are.

There is nothing wrong with the || but the whole code is very badly written and probably won't work.

WOW, it work now, thanks a lot mike!
This was my first time using #define instead of int...
I usually use int. I just wanted to see if #define changed the size of the compiled code.

So I changed it all to int:

int buzzer = PB1;//pwm pin
int button = PB2; // analogReadpin
int latchPin = PB0;
int clockPin = PB4;
int dataPin = PB5;

it works now! Thanks a lot

So I changed it all to int

And wasted several bytes. That should be:

const byte buzzer = PB1;//pwm pin
const byte button = PB2; // analogReadpin
const byte latchPin = PB0;
const byte clockPin = PB4;
const byte dataPin = PB5;

Maybe it doesn't matter yet, but if you add more code/memory usage, it will matter at some point. Learning to minimize memory usage everywhere is a good thing.

PaulS:

So I changed it all to int

And wasted several bytes. That should be:

const byte buzzer = PB1;//pwm pin

const byte button = PB2; // analogReadpin
const byte latchPin = PB0;
const byte clockPin = PB4;
const byte dataPin = PB5;



Maybe it doesn't matter yet, but if you add more code/memory usage, it will matter at some point. Learning to minimize memory usage everywhere is a good thing.

It actually matters now.
This is exactly what I wanted to learn, Paul! Thank you for the reply. I’m going to try to learn the differences now.
Thank’s a lot for the quick replies, everyone.