please help me im going crazy.

i have this project im doing it contacting 4 thing together, which they are the easyVR shield, locker, keypad and whistle, i tried to program them separately and they work just fine but when i try to join them together i get this errors problems now i have the locker, keypad and whistle working together fine but i can’t get the easyVR to work with them because it’s keep interrupting the hole program and if i do nothing would work. i tried to add a whisker so if i press it the easyVR would work and if it’s not the keypad will. here is my code please help am lost.

#include <Password.h> 
#include <Keypad.h>
#include <Servo.h>
#if defined(ARDUINO) && ARDUINO >= 100
  #include "Arduino.h"
  #include "SoftwareSerial.h"
  SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
  #include "WProgram.h"
  #include "NewSoftSerial.h"
  NewSoftSerial port(12,13);
#endif

#include "EasyVR.h"
EasyVR easyvr(port);

//Groups and Commands
enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
};

enum Group0 
{
  G0_ARDUINO = 0,
};

enum Group1 
{
  G1_OPEN = 0,
  G1_CLOSE = 1,
};


EasyVRBridge bridge;

int8_t group, idx;
Servo myservo1;
Servo myservo2;
int whisker1=0;
int val=0;
int LCD = 1;
int Wrong_Password=0; //counts how many times the password entred wrong
Password password = Password( "2A2B" );

const byte ROWS = 4; // Four rows
const byte COLS = 4; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {
    '1','2','3','A'  }
  ,
  {
    '4','5','6','B'  }
  ,
  {
    '7','8','9','C'  }
  ,
  {
    '*','0','#','D'  }
};

byte rowPins[ROWS] = { 
  26,28,30,32 };// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 
  34,36,38,40 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  pinMode (4,INPUT);
  pinMode(13,OUTPUT);
  pinMode (LCD,OUTPUT);
  Serial.begin(9600);
  char keypad.addEventListener(keypadEvent); //add an event listener for this keypad
  myservo1.attach(42);
  myservo2.attach(44);
  Serial.write(17);
  Serial.write(12);
  Serial.write(132);
  Serial.println("Who am i ;)");
  Serial.write(168);
  Serial.println("or use the passcode");

// bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(0);

  group = EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop(){
  whisker1=digitalRead(4);
  if(whisker1==HIGH)
  {
  easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

  Serial.print("Say a command in Group ");
  Serial.println(group);
  easyvr.recognizeCommand(group);

  do
  {
    // can do some processing while waiting for a spoken command
  }
  while (!easyvr.hasFinished());
  
  easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

  idx = easyvr.getWord();
  if (idx >= 0)
  {
    // built-in trigger (ROBOT)
    // group = GROUP_X; <-- jump to another group X
    return;
  }
  idx = easyvr.getCommand();
  if (idx >= 0)
  {
    // print debug message
    uint8_t train = 0;
    char name[32];
    Serial.print("Command: ");
    Serial.print(idx);
    if (easyvr.dumpCommand(group, idx, name, train))
    {
      Serial.print(" = ");
      Serial.println(name);
    }
    else
      Serial.println();
    easyvr.playSound(0, EasyVR::VOL_FULL);
    // perform some action
    action();
  }
  else // errors or timeout
  {
    if (easyvr.isTimeout())
      Serial.println("Timed out, try again...");
    int16_t err = easyvr.getError();
    if (err >= 0)
    {
      Serial.print("Error ");
      Serial.println(err, HEX);
    }
  }
}
}

void action()
{
    switch (group)
    {
    case GROUP_0:
      switch (idx)
      {
      case G0_ARDUINO:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    case GROUP_1:
      switch (idx)
      {
      case G1_OPEN:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      case G1_CLOSE:
        // write your action code here
        // group = GROUP_X; <-- or jump to another group X for composite commands
        break;
      }
      break;
    }
}
 if(whisker2==LOW){
 {
  keypad.getKey();
}

//take care of some special events
void keypadEvent(KeypadEvent eKey){
  switch (keypad.getState()){
  case PRESSED:
    Serial.print("Pressed: ");
    Serial.println(eKey);
    switch (eKey){
    case '*': 
      checkPassword(); 
      break;
    case '#': 
      password.reset(); 
      break;
    default: 
      password.append(eKey);
    }
  }
}

void checkPassword(){
  if (password.evaluate()){
    Serial.println("Success");
    Serial.write("Success");
    digitalWrite (42,HIGH);
    myservo1.writeMicroseconds(1300);       
    myservo2.writeMicroseconds(1700);
    delay (1000);
    myservo1.writeMicroseconds(1500);       
    myservo2.writeMicroseconds(1500);
    delay (10000);
    myservo1.writeMicroseconds(1700);       
    myservo2.writeMicroseconds(1300);
    delay (1000);
    myservo1.writeMicroseconds(1500);       
    myservo2.writeMicroseconds(1500);
    //Add code to run if it works
    Wrong_Password=0;// reset the counter
    password.reset(); // to reset the password
  }
  else{
    Wrong_Password=Wrong_Password+1;
    Serial.println("Wrong");
    Serial.write("Wrong..");
  //  Serial.println("#S|MAILMAN|[]#");
   
   
   
   if (Wrong_Password >=3){ // if the password has been entered 3 times or more wrong start the alarm
   for(int repeat=0; repeat<=10;repeat++){
   
    for (int i=900; i > 20; i--){
      digitalWrite(13,HIGH);
      delayMicroseconds(i);
      digitalWrite(13,LOW);
      delayMicroseconds(i);
    }
    for (int i=200; i > 20; i--){
      digitalWrite(13,LOW);
      delayMicroseconds(i);
      digitalWrite(13,HIGH);
      delayMicroseconds(i);
    }
    delay (100);
    for (int i=20; i < 700; i++){
      digitalWrite(13,HIGH);
      delayMicroseconds(i);
      digitalWrite(13,LOW);
      delayMicroseconds(i);
    }
    for (int i=20; i < 100; i++){
      digitalWrite(13,HIGH);
      delayMicroseconds(i);
      digitalWrite(13,LOW);
      delayMicroseconds(i);
    }
    
  }
   }
  }//end of if(Wrong_Password....
  
}
  
  
}

and here is the errors

sketch_may07a.ino: In function ‘void setup()’:
sketch_may07a:78: error: expected initializer before ‘.’ token
sketch_may07a.ino: At global scope:
sketch_may07a:200: error: expected unqualified-id before ‘if’

thanks

Is this line meant to be like this?

Serial.println("Who am i ;)");

Apart from that, without line numbers it's hard to know what the error messages mean.

The first message usually means there is a typo somewhere before the error that is identified.

...R

Is this the line before the first error?

 char keypad.addEventListener(keypadEvent); //add an event listener for this keypad

What is the purpose of that 'char' there?

-br

if(whisker2==LOW){
 {
  keypad.getKey();

That looks like it is outside of any function.
Difficult to tell with the indentation

awol , im trying to make the keypad active if the whisker is low billroy , if i didn't write char it would give me this problem.

sketch_may07a:78: error: 'keypadEvent' was not declared in this scope

Robin2 , it gives the command to the LCD to write on it "who im i" so the owner or reader would know what to say which is the trigger of the easyVR.

Yes, but is that code part of a function?

will i changed it to 1 because there is only 1 whisker and if it become low it should activate the keypad.

I don't understand that. Can you sort out the indentation using the auto-format tool (ctrl-T) in the IDE, then repost your code.

#include <Password.h> 
#include <Keypad.h>
#include <Servo.h>
#if defined(ARDUINO) && ARDUINO >= 100
#include "Arduino.h"
#include "SoftwareSerial.h"
SoftwareSerial port(12,13);
#else // Arduino 0022 - use modified NewSoftSerial
#include "WProgram.h"
#include "NewSoftSerial.h"
NewSoftSerial port(12,13);
#endif

#include "EasyVR.h"
EasyVR easyvr(port);

//Groups and Commands
enum Groups
{
  GROUP_0  = 0,
  GROUP_1  = 1,
};

enum Group0 
{
  G0_ARDUINO = 0,
};

enum Group1 
{
  G1_OPEN = 0,
  G1_CLOSE = 1,
};


EasyVRBridge bridge;

int8_t group, idx;
Servo myservo1;
Servo myservo2;
int whisker1=0;
int val=0;
int LCD = 1;
int Wrong_Password=0; //counts how many times the password entred wrong
Password password = Password( "2A2B" );

const byte ROWS = 4; // Four rows
const byte COLS = 4; //  columns
// Define the Keymap
char keys[ROWS][COLS] = {
  {
    '1','2','3','A'    }
  ,
  {
    '4','5','6','B'    }
  ,
  {
    '7','8','9','C'    }
  ,
  {
    '*','0','#','D'    }
};

byte rowPins[ROWS] = { 
  26,28,30,32 };// Connect keypad ROW0, ROW1, ROW2 and ROW3 to these Arduino pins.
byte colPins[COLS] = { 
  34,36,38,40 };// Connect keypad COL0, COL1 and COL2 to these Arduino pins.


// Create the Keypad
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );

void setup(){
  pinMode (4,INPUT);
  pinMode(13,OUTPUT);
  pinMode (LCD,OUTPUT);
  Serial.begin(9600);
  keypad.addEventListener(keypadEvent); //add an event listener for this keypad
  myservo1.attach(42);
  myservo2.attach(44);
  Serial.write(17);
  Serial.write(12);
  Serial.write(132);
  Serial.println("Who am i ;)");
  Serial.write(168);
  Serial.println("or use the passcode");

  // bridge mode?
  if (bridge.check())
  {
    cli();
    bridge.loop(0, 1, 12, 13);
  }
  // run normally
  Serial.begin(9600);
  port.begin(9600);

  if (!easyvr.detect())
  {
    Serial.println("EasyVR not detected!");
    for (;;);
  }

  easyvr.setPinOutput(EasyVR::IO1, LOW);
  Serial.println("EasyVR detected!");
  easyvr.setTimeout(5);
  easyvr.setLanguage(0);

  group = EasyVR::TRIGGER; //<-- start group (customize)
}

void action();

void loop(){
  whisker1=digitalRead(4);
  if(whisker1==HIGH)
  {
    easyvr.setPinOutput(EasyVR::IO1, HIGH); // LED on (listening)

    Serial.print("Say a command in Group ");
    Serial.println(group);
    easyvr.recognizeCommand(group);

    do
    {
      // can do some processing while waiting for a spoken command
    }
    while (!easyvr.hasFinished());

    easyvr.setPinOutput(EasyVR::IO1, LOW); // LED off

    idx = easyvr.getWord();
    if (idx >= 0)
    {
      // built-in trigger (ROBOT)
      // group = GROUP_X; <-- jump to another group X
      return;
    }
    idx = easyvr.getCommand();
    if (idx >= 0)
    {
      // print debug message
      uint8_t train = 0;
      char name[32];
      Serial.print("Command: ");
      Serial.print(idx);
      if (easyvr.dumpCommand(group, idx, name, train))
      {
        Serial.print(" = ");
        Serial.println(name);
      }
      else
        Serial.println();
      easyvr.playSound(0, EasyVR::VOL_FULL);
      // perform some action
      action();
    }
    else // errors or timeout
    {
      if (easyvr.isTimeout())
        Serial.println("Timed out, try again...");
      int16_t err = easyvr.getError();
      if (err >= 0)
      {
        Serial.print("Error ");
        Serial.println(err, HEX);
      }
    }
  }
}

void action()
{
  switch (group)
  {
  case GROUP_0:
    switch (idx)
    {
    case G0_ARDUINO:
      // write your action code here
      // group = GROUP_X; <-- or jump to another group X for composite commands
      break;
    }
    break;
  case GROUP_1:
    switch (idx)
    {
    case G1_OPEN:
      // write your action code here
      // group = GROUP_X; <-- or jump to another group X for composite commands
      break;
    case G1_CLOSE:
      // write your action code here
      // group = GROUP_X; <-- or jump to another group X for composite commands
      break;
    }
    break;
  }
}
else if(whisker1==LOW){
  {
    {
      keypad.getKey();
    }

    //take care of some special events
    void keypadEvent(KeypadEvent eKey){
      switch (keypad.getState()){
      case PRESSED:
        Serial.print("Pressed: ");
        Serial.println(eKey);
        switch (eKey){
        case '*': 
          checkPassword(); 
          break;
        case '#': 
          password.reset(); 
          break;
        default: 
          password.append(eKey);
        }
      }
    }

    void checkPassword(){
      if (password.evaluate()){
        Serial.println("Success");
        Serial.write("Success");
        digitalWrite (42,HIGH);
        myservo1.writeMicroseconds(1300);       
        myservo2.writeMicroseconds(1700);
        delay (1000);
        myservo1.writeMicroseconds(1500);       
        myservo2.writeMicroseconds(1500);
        delay (10000);
        myservo1.writeMicroseconds(1700);       
        myservo2.writeMicroseconds(1300);
        delay (1000);
        myservo1.writeMicroseconds(1500);       
        myservo2.writeMicroseconds(1500);
        //Add code to run if it works
        Wrong_Password=0;// reset the counter
        password.reset(); // to reset the password
      }
      else{
        Wrong_Password=Wrong_Password+1;
        Serial.println("Wrong");
        Serial.write("Wrong..");
        //  Serial.println("#S|MAILMAN|[]#");



        if (Wrong_Password >=3){ // if the password has been entered 3 times or more wrong start the alarm
          for(int repeat=0; repeat<=10;repeat++){

            for (int i=900; i > 20; i--){
              digitalWrite(13,HIGH);
              delayMicroseconds(i);
              digitalWrite(13,LOW);
              delayMicroseconds(i);
            }
            for (int i=200; i > 20; i--){
              digitalWrite(13,LOW);
              delayMicroseconds(i);
              digitalWrite(13,HIGH);
              delayMicroseconds(i);
            }
            delay (100);
            for (int i=20; i < 700; i++){
              digitalWrite(13,HIGH);
              delayMicroseconds(i);
              digitalWrite(13,LOW);
              delayMicroseconds(i);
            }
            for (int i=20; i < 100; i++){
              digitalWrite(13,HIGH);
              delayMicroseconds(i);
              digitalWrite(13,LOW);
              delayMicroseconds(i);
            }

          }
        }
      }//end of if(Wrong_Password....

    }
  }

}

and here is the errors now after

sketch_may07a.ino: In function ‘void setup()’:
sketch_may07a:78: error: ‘keypadEvent’ was not declared in this scope
sketch_may07a.ino: At global scope:
sketch_may07a:200: error: expected unqualified-id before ‘else’

keypadEvent is embedded in another function, which is why the compiler can't see it.

Edit: as is checkPassword

Sort out your braces.