#include <stdlib.h>
int pot = 0, pot_before = 0;
void loop(){
pot = analogRead(A1);
// Do your stuff here
if (abs(pot - pot_before) > 2) {
//do what you want to do here if the difference is bigger than 2
}
pot_before = pot;
}//end loop
#include <stdlib.h>
int pot = 0, pot_before = 0;
void loop(){
pot = analogRead(A1);
// Do your stuff here
if (abs(pot - pot_before) > 2) {
//do what you want to do here if the difference is bigger than 2
}
pot_before = pot;
}//end loop