combining joy stick values

So I'm trying to use a joystick to turn on an led. I have succeeded in doing so but with only one of the values received by the joystick. If I wanted to use more of the values by the joystick, I would have to use a lot of if else statements. So to simplify it, I was wondering how to use an array to combine all the values into one int. But when I go to compile, I get the error:

C:\Users\tyler\AppData\Local\Temp\arduino_modified_sketch_379286\sketch_feb26a.ino: In function 'void led()':

sketch_feb26a:43: error: lvalue required as left operand of assignment

if(value1 = valueR1 && value2 = valueR2)

^

exit status 1
lvalue required as left operand of assignment

How would I combine the values and use them?

int led1 = 13; //top
int led2 = 12; //bottom
int led3 = 11; //right
int led4 = 10; //left
int joy1 = 0; //joystick pin
int joy2 = 1; //joystick pin
int value1 = 0; //first value from joystick
int value2 = 0; //second value from joystick
int valueR1[] = {49,50,51,52,53,54}; //value1 #'s received that i want to use to turn on right led
int valueR2[] = {53,54,55,56}; //value2 #'s received that i want to use to turn on left led

void setup()
{
  pinMode(led1, OUTPUT); //top led
  pinMode(led2, OUTPUT); //bottom led
  pinMode(led3, OUTPUT); //right led
  pinMode(led4, OUTPUT); //left led
  Serial.begin(9600);
}

//simplify numbers received by 2 axis-joystick
int treatValue(int data)
{
  return (data * 9 / 1024) + 48;
}

void loop()
{
  value1 = analogRead(joy1);
  delay(50);
  value2 = analogRead(joy2);
  Serial.print(treatValue(value1));
  Serial.println(treatValue(value2));
  led();
}

void led()
{
  value1 = (value1 * 9 / 1024) + 48;
  value2 = (value2 * 9 / 1024) + 48;
  
  //turn on led on right
  if(value1 = valueR1 && value2 = valueR2)
  {
    digitalWrite(led3, HIGH);
  }
  else
  {
    digitalWrite(led3, LOW);
  }
}

This is the table I created to show the values received by joystick

JoyStick Values

(deleted)

oops haha thx ima fix that real quick

spycatcher2k:
= is not ==

Ok so upon changing = to == it uploaded fine, but the led doesn't turn on. Checking the serial monitor, I'm receiving the values just fine but the if statement doesn't want to read the arrays.

Your first value is X cordinate and second value is Y cordinate of your joystick. I think it would be much easier to look for value1 > 53 && value2 > 53. That would be upper right corner.

When you call treatValue() in the calls to Serial.print() and Serial.println(), you modify the values of global variables value1 and value2. Then, when you call led(), you make the same changes. That hardly seems reasonable.

PaulS:
When you call treatValue() in the calls to Serial.print() and Serial.println(), you modify the values of global variables value1 and value2. Then, when you call led(), you make the same changes. That hardly seems reasonable.

Yea ik lol. The treat value statement I used for the serial part. I couldn't figure out how to use it with the actual values in the if statements, so I just assigned the equation to each value in LED instead of trying to call upon treat value again.

Gabriel_swe:
Your first value is X cordinate and second value is Y cordinate of your joystick. I think it would be much easier to look for value1 > 53 && value2 > 53. That would be upper right corner.

Ah okie, that makes the values seem less complex now. Ok, ima try using that method and do an update on what happens after