Compare if two variables are equal

I have this program that reads data from a plc and then send them to a database, the received value changes until a button is pressed, so if the button is not pressed the same value is maintained and therefore value is sent several times. how could compare the previous data with the new to know if they are or are not equal, if they are the same do not send the data and if the value changes send the data. How could I make the comparison?

CODE:

int result =  node.readInputRegisters(address, bytesQty);

if (result != 0) {
  USB.println("Communication error");
  delay(1000);
} 
else 
{ 
  USB.print(F("Read value: "));
  USB.println(node.getResponseBuffer(0));
  frame.createFrame(ASCII);  

frame.addSensor(SENSOR_MODBUS_HOLDING_REGS, (int) node.getResponseBuffer(0));
  delay(1000);
}
delay(1000); 
node.clearResponseBuffer();


error = xbee802.send( RX_ADDRESS, frame.buffer, frame.length );   

if( error == 0 )
{
  USB.println(F("Envio Correcto"));
  Utils.blinkGreenLED();  
}
else 
{
  USB.println(F("Envio Erroneo"));
  Utils.blinkRedLED();
}

delay(60000);

Regards

You provide just a part of your code. Except for the fact that I can see that you use an Xbee, I have e.g. no reference to e.g. what node is and what getResponseBuffer returns.

You can look at the state change detection example that comes with the IDE. It's meant for buttons but the same principles apply to any type of input. Simply store the last reading if it differs from the previous one and send data if it differs from the previous one.

how could compare the previous data with the new to know if they are or are not equal

Your question surely answers itself. Save the value received, then next time a value is received compare the current value with the previous value. Act accordingly if they are the same or different.