Traductor Morse to Words with LCD I2C

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);}

No, use

identificacionletras();

There are other problems in your code such as

tiempo,=millis();

Your general approach is much too cumbersome to pursue, if you plan to expand it to decode all the letters.

That looks suspect too.

Please remember to use code tags when posting code.

It's also good to auto-format the code using ctrl-T or from the menu in the IDE. Your program has no indentation at all, it makes it a real chore to read.

Woah!

vector is not an array of function pointers.

I have zero clue what was intended here.

No point at all putting code after a return.

Well, I'll be honest, it's not my code so I couldn't tell you what's right or what's wrong, the code I did too at first, has a bad order and can't be read well, I understand that this code uses vectors to store the data, this data is established if it is greater than 0.5 or less, declaring a 1 or a 2, to later be compared in case there is a command of 4 that is equal and reproduces that word.

Then give us a link to the code.

I copied it more or less as requested, but as they are already indicating to me, some factors are wrong.

Hello
Take a view here to get some ideas.

Have a nice day and enjoy coding in C++.
Дайте миру шанс!

thanks broo

You need to zoom in a bit to the text, You have made some 'typos'.

work it, but, the swith to the morse, not working good

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