#include<LiquidCrystal.h>
> LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
>
> void setup()
> {
> // initialize digital pin 13 as an output.
> pinMode(8, INPUT); //l
> pinMode(13, OUTPUT); //L1
> LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
> Serial.begin(9600);
> lcd.begin(16, 2); //We are using a16*2 LCD display
> lcd.print("soil moisture");//Display a intro message
> lcd.clear();
> delay(2000);
> };
> int z;
> //the loop function runs over and over again forever
> void loop() {
> z = digitalRead(8);
> Serial.print(z);
> if (z == 0)
> {
> digitalWrite(13, LOW);
> lcd.setCursor(0, 0);
> lcd.print("moisture full");
> }
> if else (z == 1) //forward
> {
> digitalwrite(13, HIGH);
> lcd.setCursor(0, 0);
> lcd.print("pump on……")
> }
> }
Please guys help me out with these loads of errors.
I'm new to Arduino and searched a lot to solve these errors but couldn't solve them so please help me out.Preformatted text
Your improperly posted code is incomplete. Read the forum guidelines to see how to properly post code and some hints on how to get the most from this forum. Use the IDE autoformat tool (ctrl-t or Tools, Auto format) before posting code in code tags.
Here is your code posted properly and indented with the IDE autoformat tool. See the comments for the problems and solutions. Code compiles now, though I had to guess what you are trying to do in a couple of places. NOT tested.
#include<LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);
void setup()
{
// initialize digital pin 13 as an output.
pinMode(8, INPUT); //l ***** pinMode is not capitalized
pinMode(13, OUTPUT); //L1 ***** pinMode is not capitalized
//LiquidCrystal lcd(7, 6, 5, 4, 3, 2); // **** does not belong here
Serial.begin(9600);
lcd.begin(16, 2); //We are using a16*2 LCD display
lcd.print("soil moisture");//Display a intro message // **** print ! Print
// class LiquidCrystal' has no member named 'serial'
lcd.clear();
delay(2000);
} // *** no ; required
int z;
//the loop function runs over and over again forever
void loop(void)
{
z = digitalRead(8);
Serial.print(z);
if (z == 0)
{
digitalWrite(13, LOW);
lcd.setCursor(0, 0);
lcd.print("moisture full"); // **** added missing ;
} // *** no ; required;
else if (z == 1) //forward
{
// *** should be { not }
digitalWrite(13, HIGH); // **** capital W case is important
lcd.setCursor(0, 0);
lcd.print("pump on……"); // **** added missing ;
} // **** added } to close else if
}
@xyzbee
You have posted the same question twice and in the wrong place. If you wish to keep using the forum please follow the forum guidelines that were pointed out to you in reply #2.