Error message

Hi,

I´m trying to use a code provided in a site but i´m getting some errors. Can someone please help me?

Error message:

4:18: error: variable or field ‘keypadEvent’ declared void
4:18: error: ‘KeypadEvent’ was not declared in this scope
In function ‘void setup()’:
131:27: error: ‘keypadEvent’ was not declared in this scope

Lines where the error ocurred:

#include <Wire.h>
#include <Keypad.h>
//#include <LiquidCrystal_I2C.h>
#include <LiquidCrystal.h>
/*

and

void setup(){

  • lcd.begin(16, 2);*
  • Serial.begin(9600);*
  • lcd.setCursor(3,0);*
  • tone(tonepin,2400,30);*
  • lcd.print(“BLUECORE TECH”);// you can add your team name or someting cool*
  • lcd.setCursor(0,1);*
  • lcd.print(" AIRSOFT BOMB");// you can add your team name or someting cool*
  • keypad.setHoldTime(50);*
  • keypad.setDebounceTime(50);*
    _ keypad.addEventListener(keypadEvent);_
  • //PinModes*
  • pinMode(GREENLED, OUTPUT); *
  • pinMode(REDLED, OUTPUT);*
  • pinMode(RELAYPIN, OUTPUT);*

Thank you

Please use code tags. I know you can't highlight things inside code tags but the forum software eats some of your code if you don't.

The "add listener" function connects one of your functions to the event. You have to define this function; that is, write the function. This says you have a function called keypadEvent() but it isn't in the code you showed.

Hi,
Welcome to the forum.

Please read the first post in any forum entitled how to use this forum.
http://forum.arduino.cc/index.php/topic,148850.0.html then look down to item #7 about how to post your code.
It will be formatted in a scrolling window that makes it easier to read.

Thanks.. Tom... :slight_smile:

To add:

Please post complete code or post a representative example that exhibits the behaviour. The latter often makes you think and notice the error that you made.

If your code is too big (total post size roughly 9000 characters), attach it.