user29411: void setup() {
// put your setup code here, to run once:
const int buttonPin2= 2;
const int buttonPin3= 3;
const int buttonPin4= 4;
const int buttonPin5= 5;
int total=0;
int wait=0;
int buttonState = 0;  
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
}
void loop() {
int wait=5000;
while(wait>1)
  buttonState = digitalRead(buttonPin2);  
  if(buttonState == HIGH){
    total=total+1
    wait=0
  }else{
    int wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait>1)
  buttonState = digitalRead(buttonPin3);  
  if(buttonState == HIGH){
     total=total+2
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait>1)
  buttonState = digitalRead(buttonPin4);  
  if(buttonState == HIGH){
    total=total+4
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait>1)
  buttonState = digitalRead(buttonPin5);  
  if(buttonState == HIGH){
    total=total+8
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
Serial.begin(9600)
while(0=0)
  Serial.println(total)
}


user13432: There are many errors in this code. Below I have high-lighted some of them. Please check your C/C++ language reference(s).
void setup() {
// put your setup code here, to run once:
const int buttonPin2= 2;
const int buttonPin3= 3;
const int buttonPin4= 4;
const int buttonPin5= 5;
int total=0;                        <--- not used in setup()
int wait=0;                         <--- dito
int buttonState = 0;                <--- dito
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
}
void loop() {
int wait=5000;
while(wait>1)                             <--- missing block { ??
  buttonState = digitalRead(buttonPin2);  
  if(buttonState == HIGH){
    total=total+1                         <--- missing semi-colon ; 
    wait=0                                <--- dito
  }else{
    int wait=wait-1                       <--- local declare not used
  }
int wait=5000                             <--- illegal redeclare + semicolon
int buttonState = 0;                      <--- illegal redeclare  
while(wait>1)                             <--- missing block ; 
  buttonState = digitalRead(buttonPin3);  
  if(buttonState == HIGH){
     total=total+2                        <--- missing ;
    wait=0                                <--- and so on. 
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait>1)
  buttonState = digitalRead(buttonPin4);  
  if(buttonState == HIGH){
    total=total+4
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait>1)
  buttonState = digitalRead(buttonPin5);  
  if(buttonState == HIGH){
    total=total+8
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
Serial.begin(9600)
while(0=0)
  Serial.println(total)
}

Start with something much simpler and learn to master the language. Cut-and-paste programming will not help achieve any goals you might have with this sketch. You are simply wasting your time *<:)#

29411: <pre><code>void setup() {
// put your setup code here, to run once:
const int buttonPin2= 2;
const int buttonPin3= 3;
const int buttonPin4= 4;
const int buttonPin5= 5;
int total=0;
int wait=0;
int buttonState = 0;  
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
}
void loop() {
int wait=5000;
while(wait&gt;1)
  buttonState = digitalRead(buttonPin2);  
  if(buttonState == HIGH){
    total=total+1
    wait=0
  }else{
    int wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait&gt;1)
  buttonState = digitalRead(buttonPin3);  
  if(buttonState == HIGH){
     total=total+2
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait&gt;1)
  buttonState = digitalRead(buttonPin4);  
  if(buttonState == HIGH){
    total=total+4
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait&gt;1)
  buttonState = digitalRead(buttonPin5);  
  if(buttonState == HIGH){
    total=total+8
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
Serial.begin(9600)
while(0=0)
  Serial.println(total)
}
</code></pre>
 13432: <p>There are many errors in this code. Below I have high-lighted some of them. Please check your C/C++ language reference(s).</p>

<pre><code>void setup() {
// put your setup code here, to run once:
const int buttonPin2= 2;
const int buttonPin3= 3;
const int buttonPin4= 4;
const int buttonPin5= 5;
int total=0;                        &lt;--- not used in setup()
int wait=0;                         &lt;--- dito
int buttonState = 0;                &lt;--- dito
pinMode(buttonPin2, INPUT);
pinMode(buttonPin3, INPUT);
pinMode(buttonPin4, INPUT);
pinMode(buttonPin5, INPUT);
}
void loop() {
int wait=5000;
while(wait&gt;1)                             &lt;--- missing block { ??
  buttonState = digitalRead(buttonPin2);  
  if(buttonState == HIGH){
    total=total+1                         &lt;--- missing semi-colon ; 
    wait=0                                &lt;--- dito
  }else{
    int wait=wait-1                       &lt;--- local declare not used
  }
int wait=5000                             &lt;--- illegal redeclare + semicolon
int buttonState = 0;                      &lt;--- illegal redeclare  
while(wait&gt;1)                             &lt;--- missing block ; 
  buttonState = digitalRead(buttonPin3);  
  if(buttonState == HIGH){
     total=total+2                        &lt;--- missing ;
    wait=0                                &lt;--- and so on. 
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait&gt;1)
  buttonState = digitalRead(buttonPin4);  
  if(buttonState == HIGH){
    total=total+4
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
int buttonState = 0;  
while(wait&gt;1)
  buttonState = digitalRead(buttonPin5);  
  if(buttonState == HIGH){
    total=total+8
    wait=0
  }else{
    wait=wait-1
  }
int wait=5000
Serial.begin(9600)
while(0=0)
  Serial.println(total)
}
</code></pre>

<p>Start with something much simpler and learn to master the language. Cut-and-paste programming will not help achieve any goals you might have with this sketch. You are simply wasting your time *&lt;:)#</p>
