Why won't this code work

type or paste code here

#include <Wire.h>
#include
#include <Servo.h>
#include <EEPROM.h>
#include

int Button = 10; //Push Button
const byte numRows = 4; //number of rows on the keypad
const byte numCols = 4; //number of columns on the keypad

char keymap[numRows][numCols] =

{ '1', '2', '3', 'A' },
{'4', '5', '6', 'B'),
{'7', '8', '9', 'C'),
{'*', '0', '#', 'D'}
};

char keypressed; //Where the keys are stored it changes very often
char code[] = { '1', '2', '3', '4' }; //The default code, you can change it or make it a 'n' dig

char checkl[sizeof(code)]; //Where the new key is stored

Welcome to the forum

Your topic has been moved to the Programming category of the forum

Please post a complete sketch, using code tags when you do, and describe the problems that you have with it

how do I do that

#include <Wire.h>
#include <Keypad.h>
#include <Servo.h>
#include <EEPROM.h>
#include <LiquidCrystal I2C.h>

int Button = 10;         //Push Button
const byte numRows = 4;  //number of rows on the keypad
const byte numCols = 4;  //number of columns on the keypad

char keymap[numRows][numCols] =

  { '1', '2', '3', 'A' },
{'4', '5', '6', 'B'),
 {'7', '8', '9', 'C'),
 {'*', '0', '#', 'D'}
 };

  char keypressed;                       //Where the keys are stored it changes very often
  char code[] = { '1', '2', '3', '4' };  //The default code, you can change it or make it a 'n' dig


  char checkl[sizeof(code)];  //Where the new key is stored

In the second line of the code, it says #include <Keypad.h> and when I try to upload it it says Compilation error: Keypad.h: No such file or directory

#include <Wire.h>
#include <Keypad.h>
#include <Servo.h>
#include <EEPROM.h>
#include <LiquidCrystal I2C.h>

int Button = 10;         //Push Button
const byte numRows = 4;  //number of rows on the keypad
const byte numCols = 4;  //number of columns on the keypad

char keymap[numRows][numCols] =

  { '1', '2', '3', 'A' },
{'4', '5', '6', 'B'),
 {'7', '8', '9', 'C'),
 {'*', '0', '#', 'D'}
 };

  char keypressed;                       //Where the keys are stored it changes very often
  char code[] = { '1', '2', '3', '4' };  //The default code, you can change it or make it a 'n' dig


  char checkl[sizeof(code)];  //Where the new key is stored

Please post the complete code as already requested.

that is the complete code

No setup() function, no loop() function; no, sorry, that is not a complete sketch. All you have is includes and declarations, no actual code.

It's incomplete. It wouldn't compile even without the library problem. No setup() function. No loop() function.

Have you installed the Keypad library and, if so, please post the full path to where it is located on your PC

ok Thanks

These lines should have closing braces, not closing parentheses.

If you open a new and empty *.ino-file
This file isn't completely empty there will be

void setup() {
  // put your setup code here, to run once:

}

void loop() {
  // put your main code here, to run repeatedly:

}

Which is the absolutely real bare-minimum each and every Arduino-IDE-code must have.
And these lines are missing in the code that you have posted.

Take a look into this tutorial:

Arduino Programming Course

It is easy to understand and has a good mixture between explaining important concepts and example-codes to get you going. So give it a try and report your opinion about this tutorial.

@cammycam32112 - Follow this tutorial to get a good start with good code and good advice...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.