if and statement not working?

my code works fine without the if and statement but once i add it doesnt print any values

#include <SoftwareSerial.h>
SoftwareSerial Fido(2, 3); // RX, TX
#include <PS2X_lib.h>  //for v1.6
#define PS2_DAT        9  //14    
#define PS2_CMD        11  //15
#define PS2_SEL        10  //16
#define PS2_CLK        12  //17

int LYvalue;
int LXvalue;
int oldLYvalue;
int oldLXvalue;
PS2X ps2x;

void setup() {

  Serial.begin(57600);
  Fido.begin(57600);

  delay(300);  //added delay to give wireless ps2 module some time to startup, before configuring it
}

void loop() {
  
  if (ps2x.Button(PSB_L1)) { //print stick values if either is TRUE
    LYvalue = ps2x.Analog(PSS_LY);
    LYvalue = map(LYvalue, 0, 255, 130, 40);
    LXvalue = ps2x.Analog(PSS_LX);
    LXvalue = map(LXvalue, 0, 255, 39, 120);
    
    if (LXvalue != oldLXvalue && LYvalue != oldLYvalue) {
      Serial.print("<");
      Serial.print("XYValues");
      Serial.print(",");
      Serial.print(LYvalue, DEC);
      Serial.print(",");
      Serial.print(LXvalue, DEC);
      Serial.println(">");

      Fido.print("<");
      Fido.print("XYValues");
      Fido.print(",");
      Fido.print(LYvalue, DEC);
      Fido.print(",");
      Fido.print(LXvalue, DEC);
      Fido.println(">");
    }
    oldLXvalue = LXvalue;
      oldLYvalue = LYvalue;
  }
  delay(50);
}
  if (ps2x.Button(PSB_L1)) { //print stick values if either is TRUE
    LYvalue = ps2x.Analog(PSS_LY);
    LYvalue = map(LYvalue, 0, 255, 130, 40);
    LXvalue = ps2x.Analog(PSS_LX);
    LXvalue = map(LXvalue, 0, 255, 39, 120);
    
      Serial.print("before if");
    Serial.print(oldLXvalue, DEC);
      Serial.print(",");
      Serial.println(oldLYvalue, DEC);
    
    if (LXvalue != oldLXvalue && LYvalue != oldLYvalue)

added this and it prints 39,130 but it doesnt change like somehoe its not replacing oldvalue with the new one

Your right looks like it wasn't reading the joy stick values for some reason

Well, the if only fires if both x and y have changed. So you need to yank the stick diagonally. Not only that, but you need to do it fast, because if you do it slow then one value will change but not the other, and then the other will change.

merkzilla:
my code works fine without the if and statement but once i add it doesnt print any values

I can see two if statements. Perhaps if you can be more specific?

Maybe change:

    if (LXvalue != oldLXvalue && LYvalue != oldLYvalue) {

to:

    if (LXvalue != oldLXvalue || LYvalue != oldLYvalue) {