"'lcd' was not declared in this scope"

Greetings. First of all, my english is not very good, but i’m gonna try my best.

I’m trying to use the LCD Widget in advanced mode, and i’m following the example from github. The code looks like this:

In void setup, i put:

WidgetLCD lcd(V3);

In void loop, i put:

lcd.print(0,0, "Texto de prueba");     (not only in 0,0, but other coordinates as well)

When i try verifying the code or uploading it in my NodeMCU, it shows the error message:

> In function 'void loop()':
> NodeMCU_prueba_humedad:83: error: 'lcd' was not declared in this scope
>   lcd.clear();
>   ^
> exit status 1
> 'lcd' was not declared in this scope

Of course, i tried renaming the “lcd”, for example: “WidgetLCD lcd1(V3)” and renamed the instruction to “lcd1.print”, but i have the same problem.

Any help will be welcome. Thanks

You might not have all the correct libraries loading?

Besides you do NOT want all that running in the void loop() anyhow… as it will try to run hundreds of times a second and cause flooding errors. Study the Documentation and the Help Center pages for more info (links at top right of this page).

Try out the appropriate LCD example sketch from the Sketch Builder (link also at top right of this page).


Now i tried initializing the widget before the void functions, like in the example, and it worked. The problem was in typing WidgetLCD in the void setup. How can i change the tag to “solved”?

1 Like