Expected ',' or ';' before 'LiquidCrystal'

#include<LiquidCrystal.h>
int contrast=100
#define IR = A5
#define LED = 13
LiquidCrystal lcd(12,11,5,4,3,2);

void setup()
{
analogWrite(6,contrast);
lcd.begin(16,2);
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(13, OUTPUT;)

}

void loop() {
{
lcd.setCursor(0,0);
lcd.setCursor(0,1);
}
{
if int value = digitalRead(A5) = HIGH
lcd.print(" OBJECT FOUND “)
digitalWrite(LED, HIGH)
}
{
if int value digitalWrite(A5) = LOW
lcd.print(” OBJECT NOT FOUND ")
digitalWrite LED, LOW)
}
}

This line for starters; there is a similar one.

if int value = digitalRead(A5) = HIGH
int value = digitalRead(A5);
if (value == HIGH)
{
  ...
  ...
}

Read up on if/else.

thanks for your suggestions.@sterretje

You’re also missing a stack of semicolons

#include<LiquidCrystal.h>
int contrast = 100
#define IR = A5
#define LED = 13;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);//here is the problem

void setup()
{
analogWrite(6, contrast);
lcd.begin(16, 2);
Serial.begin(9600);
pinMode(A0, INPUT);
pinMode(13, OUTPUT;)

}

void loop() {
{
lcd.setCursor(0, 0);
lcd.setCursor(0, 1);
}
{ int value = digitalRead(A5);
if (value == HIGH)
lcd.print(" OBJECT FOUND “)
digitalWrite(13, HIGH)
}
{
int value = digitalRead(A5);
if (value == LOW)
lcd.print(” NO OBJECT FOUND ")
digitalWrite(13, LOW)
}
}

can you fix the commented line pls.

Hi,

Please read the post at the start of any forum , entitled “How to use this Forum”.

To add code please click this link;

You need t o look at your { and }, there are too many and unnecessary pairs.

Tom… :grinning: :+1: :coffee: :australia:

Two lines up: you need a semicolon after int contrast = 100

Also, don’t use ‘=’ in your #define statements.

You are obviously unfamiliar with C/C++. But all of the issues we have pointed out - missing semicolons, malformed #define statements, faulty if/else statements - would be trivial to fix even for a newbie, if you read through your code carefully and study any of the countless online tutorials and beginner’s guides to the C language.

People here are always willing to help, but it’s better if you put a lot of effort into it yourself first - simply that’s the best way to learn and make sure it “sticks” in your brain.

thanks bro.

1 Like