A little help please.

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

at am I doing wrong?

well - the compiler told you --> the 'mssg' variable was not declared in the scope....

(if you post your code, we can tell you a bit more)

Before you post, please read Nick Gammon's post at the top of this Forum on How To Post. Also, it makes it easier to read code if you use Ctrl-T while the code is still in the IDE. That reformats the code to make it easier for all to read. Make sure you use code tags when posting you code. Nick's post tells you how to do that.

Welcome to the Forum.

Hi. Here is the code.

#define BLYNK_PRINT SwSerial

#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include <SoftwareSerial.h>
SoftwareSerial SwSerial(10, 11); // RX, TX

LiquidCrystal_I2C lcd(0x20,20,4);  // set the LCD address to 0x27 for a 16 chars and 2 line display

#include <BlynkSimpleStream.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "*************";

// Attach virtual serial terminal to Virtual Pin V1
WidgetTerminal terminal(V1);

// You can send commands from Terminal to your hardware. Just use
// the same Virtual Pin as your Terminal Widget
  if(mssg==true&&(String("Message") != param.asStr()) )//Prints To Lcd
  if (String("Message") == param.asStr())//Initiate Lcd transfer
    terminal.println("Enter Message") ;

void setup()
  // Debug console

  // Blynk will work through Serial
  // Do not read or write this serial manually in your sketch
  Blynk.begin(Serial, auth);


void loop()

Here are the errors I’m getting.

Arduino: 1.8.1 (Linux), Board: "Arduino/Genuino Uno"

/home/pi/Arduino/sketch_B/sketch_B.ino: In function 'void BlynkWidgetWrite1(BlynkReq&, const BlynkParam&)':
sketch_B:54: error: 'mssg' was not declared in this scope
   if(mssg==true&&(String("Message") != param.asStr()) )//Prints To Lcd
sketch_B:66: error: 'mssg' was not declared in this scope
exit status 1
'mssg' was not declared in this scope

As J-M-L already pointed out, at least one problem is that you don't have the variable named mssg defined anywhere within the program.

Thanks. I’m a novice to this coding thing. I’m using example code I’ve found. Typically, I’m able to modify the code and it works. Although, I know setting a variable is somewhat fundamentally simple, but I haven’t total grasp the concept yet. Ok. Having said that. I don’t know how the format should be to declare “mssg” as a variable.

Where did you get the code from?

Nowhere is mssg defined.

You need one of these: bool mssg = false; OR bool mssg = true;

I think you need to stop, go back to the very basics, master all the examples in the IDE.


If you misspelled a word you wouldn't relearn the ABCs. Would you? Thanks, LarryD. Your input was the remedy. This is the first time I had to use boolean. I just wasn't connecting the dots. The good thing is if I were to encounter this again, I now know what to do.