Error message i do not understand

Hello Arduwizards
I have the following error problem:

i_pomba.ino: In function 'void setup()':
i_pomba:76: error: 'key1' was not declared in this scope
i_pomba:78: error: expected `;' before 'max_darm'

with the code in void():

 #include <Keypad.h>
#include <LiquidCrystal.h>
#include <Tone.h>
#define pound 14

Tone tone1;
int max_arm;
int max_darm;
int Scount;
int Mcount;
int DefuseTimer=0; 

long scMillis=0;
long interval=1000;

char pass[4];
int currentLength=0;
int i=0;
char entered[4];

int ledPin=2;
int ledPin2=3;

LiquidCrystal lcd(7,8,10,11,12,13);
const byte ROWS=4;
const byte COLS=3;
char keys[ROWS][COLS]={
   {'1','2','3'},
   {'4','5','6'},
   {'7','8','9'},
   {'*','0','#'}
};
byte rowPins[ROWS]={5,A5,A4,A2};
byte colPins[COLS]={A1,A0,A3};
Keypad keypad=Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  tone1.begin(9);
  lcd.begin(16,2);
  Serial.begin(9600);
  lcd.clear();
  lcd.setCursor(0,0);
  
  //Give me the arm time
  max_arm=1;
  do
  {
    lcd.print("Arm Time: ");
    lcd.print(max_arm);
    lcd.print("min");
    char key1=keypad.getKey();
    lcd.cursor();
    key1 == NO_KEY;
    if(key1!=NO_KEY)
    {
      if(key1=='2')
      max_arm++;
      if(key1=='8')
      max_arm--;
    }
    lcd.clear();
    lcd.setCursor(0,0);
  }while(key1 != '5')
  //Give the dissarm time
   max_darm=1;

What i'm trying to do is to make the user give me a time of arming the bomb using the keypad numbers 2 and 8 as UP and DOWN and the keypads 5 as OK

I can't immediately see what is wrong but I did spot this :

   key1 == NO_KEY;
    if(key1!=NO_KEY)

In the first line I assume that == should be = so that key1 is set to NO_KEY but if that is the case then in the second line how likely is it that key1 will not equal NO_KEY ?

By the way, the line numbers in the error messages do not match the line numbers in the code posted so have you posted the correct version of the program ?

EDIT : Now I notice that you have not posted all of the program anyway so maybe the answer is in the missing lines

As you only posted 67 lines of code it is hard to help you.

My guess is that, because key1 was defined as a local variable in line 53 it is not visible to the code at line 76 (which is not visible to me either).

Simple solution may be to make key1 a global variable.

...R

indeed i did some corrections while posting....
i declared the key1 and key3 as global vars and solved the error that gave me but i have run to some others as well :cry: it's my first ardu program so please bear with me....

the errors

This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
Arduino: 1.0.6 (Windows NT (unknown)), Board: "Arduino Uno"
i_pomba:19: error: variable or field 'timer1' declared void
i_pomba:19: error: 'max_arm' was not declared in this scope
i_pomba.ino: In function 'void loop()':
i_pomba:135: error: 'timer1' was not declared in this scope
i_pomba.ino: At global scope:
i_pomba:138: error: variable or field 'timer1' declared void

Aaaaand the whole code so far:

/*
Defusable Paintball Bomb:
Made by Vangelis Moutafis

Keypad lay out:
1  2  3
4  5  6
7  8  9
*  0  #
*/
#include <Keypad.h>
#include <LiquidCrystal.h>
#include <Tone.h>
#define pound 14

Tone tone1;
int max_arm;//hronos arm
int max_darm;//hronos disarm
int Scount=0;
char key1;
char key3;
long scMillis=0;//apo8ikefsi telefteou hronou gia 2i pros8esi
long interval=1000;//gia lepta

char pass[4];
int currentLength=0;//poios apo tous ari8mus grafetai
int i=0;
char entered[4];

int ledPin=2;//Yellow led
int ledPin2=3;//Red led

LiquidCrystal lcd(7,8,10,11,12,13);// pins tis lcd
//Gia to keypad
const byte ROWS=4;
const byte COLS=3;
char keys[ROWS][COLS]={
   {'1','2','3'},
   {'4','5','6'},
   {'7','8','9'},
   {'*','0','#'}
};
byte rowPins[ROWS]={5,A5,A4,A2};//ta pins pou en gia tis grammes
byte colPins[COLS]={A1,A0,A3};//ta pins pou en gia tis stiles
Keypad keypad=Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup(){
  pinMode(ledPin, OUTPUT);//kamei to pin 2 san output
  pinMode(ledPin2, OUTPUT);//kamei to pin 3 san output
  tone1.begin(9);
  lcd.begin(16,2);//16x2 haraktires lcd
  Serial.begin(9600);//tahitia metadwsis meta3i arduinu j lcd
  lcd.clear();
  lcd.setCursor(0,0);
  
  //Posos enna o hronos gia na tin kamun arm 
  max_arm=1;
  do
  {
    lcd.print("Arm Time: ");
    lcd.print(max_arm);
    lcd.print("min");
    key1=keypad.getKey();
    lcd.cursor();
    key1 == NO_KEY;
    if(key1!=NO_KEY)
    {
      if(key1=='2')
      max_arm++;
      if(key1=='8')
      max_arm--;
    }
    lcd.clear();
    lcd.setCursor(0,0);
  }while(key1 != '5');
  //Posos hronos gia disarm:
   max_darm=1;
  do
  {
    lcd.print("Dsrm Time: ");
    lcd.print(max_darm);
    lcd.print("min");
    key3=keypad.getKey();
    lcd.cursor();
    key3==NO_KEY;
    if(key3!=NO_KEY)
    {
      if(key3=='2')
      max_darm++;
      if(key3=='8')
      max_darm--;
    }
    lcd.clear();
    lcd.setCursor(0,0);
  }while(key3!='5');
  //Gia na men kamume kamia malakia me ton kwdiko chakarw an t evalame swsta
 lcd.print("Enter Code: ");
  while (currentLength <4)
  {
    lcd.setCursor(currentLength +6,1);
    lcd.cursor();
    char key=keypad.getKey();
    key==NO_KEY;
    if (key!=NO_KEY)
    {
      if ((key!='*')&&(key!='#'))
      {
        lcd.print(key);
        currentLength++;
        tone1.play(NOTE_C6,200);
      }
    }
  }
  
  if (currentLength == 4)
  {
    delay(500);
    lcd.noCursor();
    lcd.home();
    lcd.print("You've Entered: ");
    lcd.setCursor(6,1);
    lcd.print(pass[0]);
    lcd.print(pass[1]);
    lcd.print(pass[2]);
    lcd.print(pass[3]);
    
    tone1.play(NOTE_E6,200);
    delay(3000);
    lcd.clear();
    currentLength=0;
  }  
}

void loop(){
  timer1(max_arm);
}

void timer1(max_arm)
{
  int Scount=0;
  Serial.print(max_arm);
  Serial.println();
  
  if(max_arm<0)
  {
    lcd.noCursor();
    lcd.Clear();
    lcd.home();
    lcd.print("BOOOOOOOOOM!!!!");
    lcd.setCursor(0,1);
    lcd.print("Bomb exploded");
    
    while(max_arm)
    {
      digitalWrite(ledPin, HIGH); // sets the LED on
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin, LOW); // sets the LED off
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin2, HIGH); // sets the LED on
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin2, LOW); // sets the LED off
      tone1.play(NOTE_A2, 90);
      delay(100); 
      }
  }
  lcd.setCursor(0,1);//2i grammi
  lcd.print("Timer:");
  if (max_arm >= 10)
    {
      lcd.setCursor (10,1);
      lcd.print (Max_arm);
    }
  if (max_arm < 10) 
    {
      lcd.setCursor (7,1);
      lcd.write ("0");
      lcd.setCursor (8,1);
      lcd.print(max_arm);
    }
  lcd.print (":");
  
  if (Scount >= 10) 
    {
      lcd.setCursor (10,1);
      lcd.print (Scount);
    }
  if (Scount < 10) 
    {
      lcd.setCursor (10,1);
      lcd.write ("0");
      lcd.setCursor (11,1);
      lcd.print (Scount);
    }
    
     if (Scount <1) // if 60 do this operation
    {
      max_arm--; // - 1 sta lepta
      Scount = 59; // reset Scount
    }

  if (Scount > 0) // do this oper. 59 times
    {
      unsigned long currentMillis = millis();
  
      if(currentMillis - secMillis > interval) 
        {
          tone1.play(NOTE_G5, 200);
          secMillis = currentMillis;
          Scount --; // add 1 to Scount
          digitalWrite(ledPin2, HIGH); // sets the LED on
          delay(10); // waits for a second
          digitalWrite(ledPin2, LOW); // sets the LED off
          delay(10); // waits for a second
          //lcd.clear();
        }
    }
    if(max_arm==2)
      digitalWrite(letPin2,HIGH);
    if(max_arm==1){
      digitalWrite(ledPin,HIGH);
      digitalWrite(ledPin2,LOW);
    }

}

sorry i uploded with greek comments i will upload with english

/*
Defusable Paintball Bomb:
Made by Vangelis Moutafis

Keypad lay out:
1  2  3
4  5  6
7  8  9
*  0  #
*/
#include <Keypad.h>
#include <LiquidCrystal.h>
#include <Tone.h>
#define pound 14

Tone tone1;
int max_arm;//Time to arm
int max_darm;//Time to disarm
int Scount=0;
char key1;
char key3;
long scMillis=0;
long interval=1000;

char pass[4];
int currentLength=0;
int i=0;
char entered[4];

int ledPin=2;//yellow led
int ledPin2=3;//Red led

LiquidCrystal lcd(7,8,10,11,12,13);// pins of lcd
//For keypad
const byte ROWS=4;
const byte COLS=3;
char keys[ROWS][COLS]={
   {'1','2','3'},
   {'4','5','6'},
   {'7','8','9'},
   {'*','0','#'}
};
byte rowPins[ROWS]={5,A5,A4,A2};//pins for rows
byte colPins[COLS]={A1,A0,A3};//pins for colums
Keypad keypad=Keypad(makeKeymap(keys), rowPins, colPins, ROWS, COLS);

void setup(){
  pinMode(ledPin, OUTPUT);
  pinMode(ledPin2, OUTPUT);
  tone1.begin(9);
  lcd.begin(16,2);//16x2 lcd
  Serial.begin(9600);
  lcd.clear();
  lcd.setCursor(0,0);
  
  //give time to arm
  max_arm=1;
  do
  {
    lcd.print("Arm Time: ");
    lcd.print(max_arm);
    lcd.print("min");
    key1=keypad.getKey();
    lcd.cursor();
    key1 == NO_KEY;
    if(key1!=NO_KEY)
    {
      if(key1=='2')
      max_arm++;
      if(key1=='8')
      max_arm--;
    }
    lcd.clear();
    lcd.setCursor(0,0);
  }while(key1 != '5');

  //Give time to dissarm
   max_darm=1;
  do
  {
    lcd.print("Dsrm Time: ");
    lcd.print(max_darm);
    lcd.print("min");
    key3=keypad.getKey();
    lcd.cursor();
    key3==NO_KEY;
    if(key3!=NO_KEY)
    {
      if(key3=='2')
      max_darm++;
      if(key3=='8')
      max_darm--;
    }
    lcd.clear();
    lcd.setCursor(0,0);
  }while(key3!='5');

  //Give code
 lcd.print("Enter Code: ");
  while (currentLength <4)
  {
    lcd.setCursor(currentLength +6,1);
    lcd.cursor();
    char key=keypad.getKey();
    key==NO_KEY;
    if (key!=NO_KEY)
    {
      if ((key!='*')&&(key!='#'))
      {
        lcd.print(key);
        currentLength++;
        tone1.play(NOTE_C6,200);
      }
    }
  }
  
  if (currentLength == 4)
  {
    delay(500);
    lcd.noCursor();
    lcd.home();
    lcd.print("You've Entered: ");
    lcd.setCursor(6,1);
    lcd.print(pass[0]);
    lcd.print(pass[1]);
    lcd.print(pass[2]);
    lcd.print(pass[3]);
    
    tone1.play(NOTE_E6,200);
    delay(3000);
    lcd.clear();
    currentLength=0;
  }  
}

void loop(){
  timer1(max_arm);
}

void timer1(max_arm)
{
  int Scount=0;
  Serial.print(max_arm);
  Serial.println();
  
  if(max_arm<0)
  {
    lcd.noCursor();
    lcd.Clear();
    lcd.home();
    lcd.print("BOOOOOOOOOM!!!!");
    lcd.setCursor(0,1);
    lcd.print("Bomb exploded");
    
    while(max_arm)
    {
      digitalWrite(ledPin, HIGH); // sets the LED on
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin, LOW); // sets the LED off
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin2, HIGH); // sets the LED on
      tone1.play(NOTE_A2, 90);
      delay(100); 
      digitalWrite(ledPin2, LOW); // sets the LED off
      tone1.play(NOTE_A2, 90);
      delay(100); 
      }
  }
  lcd.setCursor(0,1);//2nd line lcd
  lcd.print("Timer:");
  if (max_arm >= 10)
    {
      lcd.setCursor (10,1);
      lcd.print (Max_arm);
    }
  if (max_arm < 10) 
    {
      lcd.setCursor (7,1);
      lcd.write ("0");
      lcd.setCursor (8,1);
      lcd.print(max_arm);
    }
  lcd.print (":");
  
  if (Scount >= 10) 
    {
      lcd.setCursor (10,1);
      lcd.print (Scount);
    }
  if (Scount < 10) 
    {
      lcd.setCursor (10,1);
      lcd.write ("0");
      lcd.setCursor (11,1);
      lcd.print (Scount);
    }
    
     if (Scount <1) // if 60 do this operation
    {
      max_arm--; // - 1 in minits
      Scount = 59; // reset Scount
    }

  if (Scount > 0) // do this oper. 59 times
    {
      unsigned long currentMillis = millis();
  
      if(currentMillis - secMillis > interval) 
        {
          tone1.play(NOTE_G5, 200);
          secMillis = currentMillis;
          Scount --; // add 1 to Scount
          digitalWrite(ledPin2, HIGH); // sets the LED on
          delay(10); // waits for a second
          digitalWrite(ledPin2, LOW); // sets the LED off
          delay(10); // waits for a second
          //lcd.clear();
        }
    }
    if(max_arm==2)
      digitalWrite(letPin2,HIGH);
    if(max_arm==1){
      digitalWrite(ledPin,HIGH);
      digitalWrite(ledPin2,LOW);
    }

}

That rather confusing error is caused by the IDE's efforts to define function prototypes for you. This:

void timer1(max_arm)

needs a type for the parameter - likely:

void timer1(int max_arm)

indeed..... i need to dust up the basics