'lcd' was not declared in this scope. Plz help

Hi, ive been trying to build something, but I keep on getting the ''lcd' was not declared in this scope' error message.

#include <LiquidCrystal.h>

#define MQ3pin 8

int sensorValue; //variable to store sensor value

void setup() {
lcd.begin(16,2); // start the lcd
lcd.backlight(); // LCD back light on
lcd.println("MQ3 warming up!");
delay(20000); // allow the MQ3 to warm up
}

void loop() {
lcd.setCursor(0,0)
sensorValue = digitalRead(MQ3pin); // read digital output pin
lcd.print("Digital Output: ");
lcd.print(sensorValue);

// Determine the status
if (sensorValue) {
lcd.println(" | Alcohol: -");
} else {
lcd.println(" | Alcohol: Detected!");
}

delay(2000); // wait 2s for next reading
lcd.clear()
}

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the </> icon above the compose window) to make it easier to read and copy for examination

You have not declared an instance of the LiquidCrystal library names lcd. Compare your code with the library examples

The error message is correct, lcd is not declared.

Have you looked at the LCD examples to see how to declare lcd?

By typing the words "arduino lcd" into an internet search engine you can find, Arduino - LCD | Arduino Tutorial (arduinogetstarted.com), one example of many that shows how to use the lcd.

If you want you can wait for me to correct the error or you can do your own research.

And when you post code, use code tags, please.

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