Comparing variables to their old values.

Hi,

I need a way to check if Variable1 is the same as it was last time Variable2 was the same as it is now.

This has been very puzzling to me for rather a while.

Thanks very much for your help.

Also store the last value it had you checked it. And simply compare the value to that the next time.

Without simple code I can't be more specific :slight_smile: You might want to look at the "State change" example which does use it.

int var, oldvar;
if (var!=oldvar) {
  // do stuff
  oldvar=var;
}