update returns true if a change is detected; false otherwise update is rate limited. additional calls will always return false
55 const int16_t old_ai[4] = {
ai[0],
ai[1],
ai[2],
ai[3]};
57 ai[0] = (
ai[0] * 0.4) + (analogRead(AN1) * 0.6);
58 ai[1] = (
ai[1] * 0.4) + (analogRead(AN2) * 0.6);
59 ai[2] = (
ai[2] * 0.4) + (analogRead(AN3) * 0.6);
60 ai[3] = (
ai[3] * 0.4) + (analogRead(AN4) * 0.6);
69 if (abs(
ai[0] - old_ai[0])>TRIGGER_DELTA) trigger =
true;
70 if (abs(
ai[1] - old_ai[1])>TRIGGER_DELTA) trigger =
true;
71 if (abs(
ai[2] - old_ai[2])>TRIGGER_DELTA) trigger =
true;
72 if (abs(
ai[3] - old_ai[3])>TRIGGER_DELTA) trigger =
true;