Hello, this code is about a translator from morse to words and that are reproduced on an LCD screen with an I2C adapter, the problem with this code is that the word "idetificacionletra" is not recognized. the code only has one word to test the code.
#include <LiquidCrystal_I2C.h>
int led=9;
int boton=8;
int buzzer=6;
int pausa=7;
int valor=0;
int valorpausa=0;
float tiempo=0;
long tiempo1=0;
long tiempo2=0;
float tiempo3=0;
int vector[4]={0,0,0,0};
int i=0;
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7);
void setup(){
Serial.begin(9600);
lcd.begin(16,2);
lcd.print("Hola profe");
pinMode(led,OUTPUT);
pinMode(buzzer,OUTPUT);
pinMode(boton,INPUT_PULLUP);
pinMode(pausa,INPUT_PULLUP);
}
void loop(){
if(tiempo1==0) lcd.clear(); //checar clear
valor=digitalRead(boton);
if(valor==LOW)
{
tiempo=lecturatiempo();
if(tiempo<0.5) vector[i]=1;
if(tiempo>0.5) vector[i]=2;
i=i+1;
}
valorpausa=digitalRead(pausa);
if(valorpausa==LOW)
{
identificacionletras;
vector[0]=0; vector();
i=0;[1]=0; vector[2]=0; vector[3]=0;
}
}
float lecturatiempo()
{
valor=digitalRead(boton);
if(valor == LOW)
{
tiempo,=millis();
digitalWrite(led,HIGH);
digitalWrite(buzzer,HIGH);
while(valor == LOW)
{
tiempo2=millis();
valor = digitalRead(boton);
}
tiempo3=tiempo2-tiempo1;
tiempo3=tiempo3/1000;
Serial.println(tiempo3);
}
if(valor==HIGH) (digitalWrite(led,LOW); digitalWrite(buzzer,LOW);}
return tiempo3;
tiempo3=0;
}
void identificacionletras()
{
if(vector[0]==1 && vector[1]==2 && vector[2]==0 && vector[3]==0) {lcd.print("A");delay(600);}