pseudo-code translation needed

I am alternately reading two analog voltages from pins A0 and A1; can you suggest how I might implement the following pseudo-code please?

is there a reading?
does this reading jump +/- 50
if yes, ignore it
if no, read it

I'll post my code if it's needed, but essentially it's reading from one pin, switching it's state then reading another pin.

Thanks

You might get some help if you posted your question to an appropriate board, like the software troubleshooting etc.

I'll post my code if it's needed, but essentially it's reading from one pin, switching it's state then reading another pin.

If you are switching the state of the pin, it must be a digital pin. Digital pins are either LOW (0) or HIGH (1). If the reading was 0, and is now 1, that's a 100% increase. It it was 1 and is now 0, that's a 100% decrease. Not terribly difficult to determine that a +50% change has occurred.

If you are not reading from digital pins, you are not changing the pin's state, so you need to clarify what you are doing. Posting code would be a good idea, too.

@liudr
my bad, i'll post there; but i'm reading from hardware and getting major jitter which is why i posted here

@PaulS
it's analog pins, but i'll post in the software board

If it is WRONG that the readings are jittering, then this may be a hardware question.

If, because of the nature of what is being read, the +/- 50 jitter is normal, and you need a way to ignore it, then sometimes there are hardware solutions, sometimes you just "make the problem go away" with clever software.

Either pursue a software solution in one of the software forums, or tell us more about the source of the signal, if you want help with a hardware-level cure?

Sounds like you are leaving the analogue pin open circuit or at least too higher input impedance. You need to describe what you have as hardware.

it's analog pins,

Then how are you doing this?

switching it's state then reading another pin.

You can't switch the state of an analog pin. They are input only.