Changing variable

Jaguarjoe

Senior Member
How can I tell when a variable changes? I have a pot hooked up to an ADC input and simply need to know when the pot is moved from its current position, either up or down. The result of that will then reset the processor forcing my pause times to reset to the new value the pot is at.

Thanks in advance,

Joe
 

Jeremy Leach

Senior Member
Hi, every time you read the ADC value, do something like this..
Code:
'Initialise
Read from ADC into CurrentADCValue

'Main
Do
    OldADCValue = CurrentADCValue
    Read from ADC into CurrentADCValue
    If CurrentADCValue <> OldADCValue then the value has changed and take action.
Loop
 
Last edited:
Top