AnalogWrite not working in if statement Arduino Uno with ATMega328P Processor.analogWrite is not working properly in if statement. It changes the brightness of the LED as if there wasn't any if statement at all.

There are 2 potentiometers to create an intervall in which to program increases of the LED brightness, starting at 40% of the maximum. When it's lower than the minimum value, the LED is turned off.

int ledPin = 6;
int sensorPot = 1; // it's a potentiometer for now
int maxPot = 7; // potentiometer 
int minPot = 3; // potentiometer
int fortypercent = 255*0.4;
int brightness = 0;

void setup() {
  pinMode(ledPin, OUTPUT);
  pinMode(sensorPot, INPUT);
  pinMode(maxPot, INPUT);
  pinMode(minPot, INPUT);
  Serial.begin(9600);
}

void loop() {
  int start = analogRead(minPot);
  int maxVal = analogRead(maxPot);
  int sensor = analogRead(sensorPot);
  Serial.println(sensor/4);
  Serial.println(start/4);
  Serial.println(maxVal);
  if(sensor/4 &gt; start/4) {
    analogWrite(ledPin,sensor/4);
  } else if(sensor = baslangic) {
    analogWrite(ledPin,LOW);
  } else if ((start &lt; sensor &lt; maxVal)) {
    brightness = sensor/4 - fortypercent;
    analogWrite(ledPin,brightness); 
  } else if (sensor = maxVal) {
    analogWrite(ledPin , 255);
  }
}
ORIGINAL RESPONSE, BASED ON DIFFERENT CODE

You are comparing sensorValue to see if it's ever less than minValue.

However, you have mapped sensorValue to range from 0 to 255, and minValue is set at 0. How can anything from 0-255 be less than zero?

NEW RESPONSE, BASED ON UPDATED CODE

One of your if statements: else if(sensor = baslangic) is not comparing, but assigning baslangic to sensor. To compare, use ==.

Your other if statement: else if ((start &lt; sensor &lt; maxval)) is wrong. C++ doesn't work this way. Maybe you want: if ((start&lt;sensor) &amp;&amp; (sensor&lt;maxval))? 

Instead, your statement evaluates like if ( (start&lt;sensor) &lt; (maxval) ), which means you are comparing the TRUE or FALSE of (start&lt;sensor) to the int that is maxval.