School project HELP!

I found this program and I’m having a hard time changing from I2C to the normal Liquid Crystal this is for a school project so I have to change the program and I cant simply use a I2C and I don’t know how to operate that well in Arduino if you could help it would be amazing

Here is the program:
//Bibliotecas
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <Keypad.h>

//Inicialização do Display I2C
LiquidCrystal_I2C lcd(0x27,16,2);

int count = 0; //Contador de uso geral
char pass [4] = {‘1’, ‘9’, ‘7’, ‘1’}; //Senha
const int yellowPin = 11; //Definição do pino do LED Amarelo
const int redPin = 12; //Definição do pino do LED Vermelho
const int greenPin = 10; //Definição do pino do LED Verde
const int audioPin = 9; //Definição do pino do Buzzer
const int duration = 200; //Duração das sons tocados
const byte ROWS = 4; //Quatro linhas
const byte COLS = 3; //Três colunas

//Mapeamento de teclas
char keys[ROWS][COLS] = {
{‘1’,‘2’,‘3’},
{‘4’,‘5’,‘6’},
{‘7’,‘8’,‘9’},
{’*’,‘0’,’#’}
};
byte rowPins[ROWS] = {5, 4, 3, 2}; //Definição de pinos das linhas
byte colPins[COLS] = {6, 7, 8}; //Definição de pinos das colunas

//Cria o teclado
Keypad keypad = Keypad( makeKeymap(keys), rowPins, colPins, ROWS, COLS );
//Programa inicial
void setup(){
lcd.init(); //Inicializa o LCD
lcd.backlight(); //Com Backlight
Serial.begin(9600); //Inicializa a comunicação serial a 9600 bps

//Deifinição de modo dos pinos
pinMode(audioPin, OUTPUT);
pinMode(yellowPin, OUTPUT);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
lcd.clear(); //Limpa LCD
key_init(); //Inicializa o sistema
}

//Loop Principal do Programa
void loop(){
char key = keypad.getKey(); //Obtém tecla pressionada
if (key != NO_KEY){ //Se foi pressionada uma tecla:
if (key == ‘#’) { //Se a tecla é ‘#’
code_entry_init(); //Então espera que seja inserida uma senha
int entrada = 0;
while (count < 4 ){ //Conta 4 entradas/teclas
char key = keypad.getKey(); //Obtém tecla pressionada
if (key != NO_KEY){ //Se foi pressionada uma tecla:
entrada += 1; //Faz entrada = entrada + 1
tone(audioPin, 1080, 100); //Para cada dígito emite um som de indicação
delay(duration); //Duração do som
noTone(audioPin); //Para de emitir som
if (key == pass[count])count += 1; //Se a tecla pressionada corresponde ao dígito
//da senha correspondente, soma 1 no contador
if ( count == 4 ) unlocked(); //Se contador chegou a 4 e com dígitos corretos,
//desbloqueia siatema
if ((key == ‘#’) || (entrada == 4)){ //Se foi pressionada a tecla "#’ ou foram feitas
//4 entradas,
key_init(); //Inicializa o sistema
break; //Para o sistema e espera por uma tecla
}
}
}
}
}
}

//Inicializar o Sistema
void key_init (){
lcd.clear(); //Limpa o LCD
lcd.print(“Aguardando…”); //Emite mensagem
lcd.setCursor(0,1); //Muda de linha
lcd.print(“Tecle #”); //Emite mensagem

count = 0; //Variável count é zero na inicialização

//Emite som e acende LED Vermelho, indicando Sistema Iniciado
digitalWrite(redPin, HIGH);
digitalWrite(yellowPin, LOW);
digitalWrite(greenPin, LOW);
tone(audioPin, 1080, 100);
delay(duration);
noTone(audioPin);
tone(audioPin, 980, 100);
delay(duration);
noTone(audioPin);
tone(audioPin, 770, 100);
delay(duration);
noTone(audioPin);
}

//Subrotina de Entrada da Senha
void code_entry_init(){
lcd.clear(); //Limpa LCD
lcd.print(“Entre a Senha:”); //Emite mensagem

count = 0; //Variável count é zero na entrada de senha

//Emite som e acende LEDs
tone(audioPin, 1500, 100);
delay(duration);
noTone(audioPin);
tone(audioPin, 1500, 100);
delay(duration);
noTone(audioPin);
tone(audioPin, 1500, 100);
delay(duration);
noTone(audioPin);
digitalWrite(redPin, LOW); //Apaga LED Vermelho
digitalWrite(yellowPin, HIGH); //Acende LED Amarelo
digitalWrite(greenPin, LOW); //Apaga LED Verde
}

//Subrotina para Acesso Liberado
void unlocked(){
lcd.clear(); //Limpa LCD
lcd.print(“Acesso Liberado!”); //Emite mensagem

digitalWrite(redPin, LOW); //Apaga LED Vermelho
digitalWrite(yellowPin, LOW); //Apaga LED Amarelo

//Executa 20 vezes ± 5 segundos, emite som e pisca LED verde
for (int x = 0; x < 20; x++){
digitalWrite(greenPin, HIGH);
tone(audioPin, 2000, 100);
delay(duration);
noTone(audioPin);
digitalWrite(greenPin, LOW);
tone(audioPin, 2000, 100);
delay(duration);
noTone(audioPin);
delay(250);
}
}

I cant simply use a I2C

What problems are you having ? How is the LCD connected to the Arduino ? Do the examples with the LiquidCrystal_I2C library work ?

I'm not having any problem it the code. The program works fine with a I2C Display. All I need to do is to make the current program work with a normal LCD instead of I2C. Im not very proficient using arduino and my teacher doesn't want to help me because he's lazy.

Your teacher is lazy?

It’s kinda sad to say so but yeah he doesn’t do anything he’s just that type of teacher.

You were asked:

How is the LCD connected to the Arduino ?

Will you comply or complain?

zeca2099: Im not very proficient using arduino and my teacher doesn't want to help me because he's lazy.

Is it possible that he wants you do some research or reading and work out how to do it yourself ?

Start by helping us to help you. Please edit your post and add code tags (

[code]

and

[/code]

) around your code.

Next look at a simple example of the standard LiquidCrystal display; e.g. the hello world example 1) Do you see a difference in what you include currently and what the helloworld includes when it comes to the LCD? 2) Do you see a difference on how the LCD object is created between the your code and the helloworld code? The latter requires the use of 6 pins. Find 6 free pins, wire the LCD accordingly, modify the constructor ( lcd(........); ) and you should be well on your way. Compile and test.

Notes: You might need a 7th pin for the backlight; not sure, I've never used it. The code might not compile due to the backlight call; if needed, find an alternative way to do it ;)

The I2C LCD needs 2 IO lines: (SDA, SCL) = (A4, A5)

The Normal LCD needs 6 IO lines: RS, E, D4, D5, D6, D7 (LiquidCrystal lcd(RS, E, D4, D5, D6, D7))

You have already used these IO lines: (0, 1 are usually reserved), 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12

If you disconnect I2C LCD, you will have the availability of 7 IO lines (A0, A1, A2 A3, A4, A5, 13)

It is hoped that you will be able to use the above information to get your normal LCD working (do not forget to include the file: LiquidCrystal.h).