Cant Set A Range

 if (analogValue > threshold1 || analogValue < Maxvalue) {
    digitalWrite(ledPin1, HIGH);
  } 
  else {
    digitalWrite(ledPin1,LOW); 
  };
if (analogValue > threshold1 || analogValue < Maxvalue) {
    digitalWrite(ledPin1, HIGH);
  } 
  else {
    digitalWrite(ledPin1,LOW); 
  };

Are these wrong? Cause it easily verifies the code, but doesn’t do what i intended it to do.
I want to set a range for the LED to turn on and off,but instead they all turn on and never off.

Logical-and (&&) is nearly always used when checking a range.

One could write these kind of statements this way

if ( (a < b) || (c < a)) // to show that a lies outside the range b,c

or

if ( (b < a) && (a < c)) // to show a lies within the range b,c

just a code thought:
#define outside(x,a,b) (((x)<(a))||((b)<(x)))
#define between(x,a,b) (((a)<=(x))&&((x)<=(b)))
note that between is inclusive and outside not.
or written as
#define between(x,a,b) (!outside(x,a,b))
but that said, macros are dangerous …

if (analogValue > threshold1 || analogValue < Maxvalue) {

The compiler interprets this to mean

is one of (analogValue > threshold1) true OR (analogValue < Maxvalue) is true

Numbers that are below threshold1 (i.e. which fail the first test) will (presumably) be less than Maxvalue so the second test will pass.

I suspect that is not what you want - you probably need && rather than || to ensure that both tests pass.

We (humans) tend to use rather sloppy language to describe this sort of problem and we intuitively know what we mean. But the compiler is neither sloppy nor intuitive.

…R