Condition not fulfilled yet it execute

hello everyone
am working on a project but i have a problem with a condition, the LCD screen is supposed to display LAV-ARR not ESS-ARR since the first condition is not fulfilled
help me please.

a picture of text - so convenient.... It's beyond me why some people think this would be appropriate, usable, helpful...

Do yourself a favour and please read How to get the best out of this forum and modify your post accordingly (including code tags and necessary documentation of your ask).

Look at your analogRead.
Carefully.

And yeah, don't post pictures - we're not Ancient Egyptians.

Look at your condition, maybe you put closing bracket ) in the wrong place?

No, the closing bracket is in the right place.
The one before it however...

Please don’t confuse OP, we might be here all night

That's funny, I was about to say the same thing to you.
Oh. I did

there are two issues

image

:grimacing: :grimacing:

It's the same issue, just fuzzier.

I see what you did there

ah if you could see it, I failed then... I'll try again :wink:


there are two issues (twice the same)
image

1 Like

sorry am new to this how can i fix it.

You post your actual code, in code tags.

1 Like
#include <LiquidCrystal.h>
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

int analogPin1 = 19;
int analogPin2 = 20;
int analogPin3 = 21;
int analogPin4 = 22;
int analogPin5 = 23;
int analogPin6 = 24;
int analogPin7 = 25;
int analogPin8 = 26;

int Vin = 5;
float Vout = 0;

float R1 = 1000;
float R2 = 0;

float essarr = 0;
float lavarr = 0;
float inter = 0;
float pv = 0;
float gv = 0;
float lavav = 0;
float adac1 = 0;
float adac2 = 0;

float buffer = 0;
void setup() {
  lcd.clear();
  lcd.begin(16, 2);
}

void loop() {
  if (analogRead(analogPin1 != 0)) {

    buffer = analogRead(analogPin1) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    essarr = R1 * buffer;

    //Serial.print("ess-arr: ");
    //Serial.println(essarr);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("ess-arr: ");
    lcd.print(essarr);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin2 != 0)) {

    buffer = analogRead(analogPin2) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    lavarr = R1 * buffer;

    //Serial.print("lav-arr: ");
    //Serial.println(lavarr);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("lav-arr: ");
    lcd.print(lavarr);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin3 != 0.0)) {

    buffer = analogRead(analogPin3) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    inter = R1 * buffer;

    //Serial.print("inter: ");
    //Serial.println(inter);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("inter: ");
    lcd.print(inter);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin4 != 0.0)) {

    buffer = analogRead(analogPin4) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    pv = R1 * buffer;

    //Serial.print("PV: ");
    //Serial.println(pv);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("pv: ");
    lcd.print(pv);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin5 != 0.0)) {

    buffer = analogRead(analogPin5) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    gv = R1 * buffer;

    //Serial.print("gv: ");
    //Serial.println(gv);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("gv: ");
    lcd.print(gv);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin6 != 0.0)) {

    buffer = analogRead(analogPin6) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    lavav = R1 * buffer;

    //Serial.print("lav-av: ");
    //Serial.println(lavav);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("lav-av: ");
    lcd.print(lavav);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else if (analogRead(analogPin7 != 0.0)) {

    buffer = analogRead(analogPin7) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    adac1 = R1 * buffer;

    //Serial.print("adac1: ");
    //Serial.println(adac1);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("adac1: ");
    lcd.print(adac1);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
  else {

    buffer = analogRead(analogPin8) * Vin;
    Vout = (buffer) / 1024.0;
    buffer = (Vin / Vout) - 1;
    adac2 = R1 * buffer;

    //Serial.print("adac2: ");
    //Serial.println(adac2);

    lcd.setCursor(0, 0);
    lcd.print("Vout: ");
    lcd.print(Vout);

    lcd.setCursor(0, 1);
    lcd.print("adac2: ");
    lcd.print(adac2);
    delay(1000);
    lcd.clear();
    lcd.print("clean");
    delay(1000);
  }
}

(OK, not an actual quote)

Please remember to use code tags when posting code

@J-M-L see? There were even more)

Now I see ! :slight_smile:
(and I fixed the code tags to get OP out of his misery...)

Uh, which board are you using?

arduino nano

The Uno has only six analogue inputs.