[SOLVED] How To Transfer a Message from Terminal To LCD

I want to transfer the message from the Terminal and send it To a LCD connected to the Arduino.
The terminal is on V1

   BLYNK_WRITE(V1) 
{
  if (String("Message") == param.asStr()) 
      {
        terminal.println("Enter Message") ;
        lcd.setCursor(0,1);
        lcd.print(param.asString());
     }
}

But the output of this is my LCD is getting the word “Message” is getting Printed.

Help would be appreciated

1 Like

Yeah, that’s not gonna fly :smile:

BLYNK_WRITE(V1) 
{
message = param.asString()

lcd.setCursor(0,1);
lcd.print(message)
}

In your code the LCD only sets the message if the message is equal to “message”, you need to store it in a variable.

2 Likes

Sorry i didn’t put the right code. Actually what i want to happen is First the user types Message in terminal.
Then Terminal Will reply “Please Enter The Message”.After that the user types something and then i want to print that to the LCD.

`
BLYNK_WRITE(V1)
{
if (String(“Message”) == param.asStr())
{
terminal.println(“Enter Message”) ;

    terminal.write(param.getBuffer(), param.getLength());
    lcd.clear();
    lcd.setCursor(0,1);
    lcd.print(param.asString());
  
  }

}
‘’

Check the Terminal example sketch included in the Blynk library.

It covers this case.

1 Like

Pavel sorry i couldn’t make it out in the example. Would you pls explain.But i did figure it out a way how to do it.

BLYNK_WRITE(V1) 
{
  if(mssg==true&&(String("Message") != param.asStr()) )//Prints To Lcd
    {
   
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(param.asString());
    mssg=false;
    }
  if (String("Message") == param.asStr())//Initiate Lcd transfer
  {
    lcd.clear();
    terminal.println("Enter Message") ;
    mssg=true;
 
  }
}

The first If is used only after the Second if is satisfied.Hope this helpful to someone.

1 Like

Could you explain how you have achieved this?
I am new to Coding/Blynk and am trying to use a terminal to write to a Physical LCD (not the one on the app). I have used code from the example terminal, and copied parts from a previous sketch that includes pin setup etc. for the LCD. I have tried using this code below within the void.setup() below but it receives an error when compiling.

terminal.print("You said:"); terminal.write(param.getBuffer(), param.getLength()); terminal.println(); lcd.print(param.getBuffer(), param.getLength()); delay(1000);

Could you perhaps show and explain your “solved” code if you have achieved this, Thanks.

Hi Norand sorry took so long to reply havent been active.you cant put this code in the void setup.The function void setup is only executed once too to setup pins.Your coding for the terminal has to be entered in a method

BLYNK_WRITE(Virtual pin that correspond to the terminal in app)
{
}

Also the code which you are trying to use is gibberish non sense which i tried.It doesn’t work.Try this code

BLYNK_WRITE(V1) 
{
  if(mssg==true&&(String("Message") != param.asStr()) )//Prints To Lcd
    {
   
    lcd.clear();
    lcd.setCursor(0,0);
    lcd.print(param.asString());
    mssg=false;
    }
  if (String("Message") == param.asStr())//Initiate Lcd transfer
  {
    lcd.clear();
    terminal.println("Enter Message") ;
    mssg=true;
 
  }
}

This has worked and its tested.So what happens out here when the user on the app types “Message” in the terminal it makes the mssg variable become true and the whatever is typed after that is printed onto the L.C.D.

1 Like

hi dude, may i know hats the data type format for mssg, is it boolean??or char?

I have used boolean.

I received an error when the code is compiled, "mssg’ was not declared in the scope. What am I doing wrong?

@xphactor if you study this thread it suggests you need this following global variable declaration (after your libraries):

bool mssg;

Not sure if the initial declaration should be true or false but you can work that bit out by testing.