I am currently having an issue with the photon system where if a non synced key fob button is hit the device will give a 0 (unidentified ID) on the next button press from a synced key fob. Once you hit the synced key fobs button again you will get the correct ID of 1. Is there a way to keep this from happening so the button presses are not missed? We are using 4 remotes that are synced to one base station so we are using the ID’s to tell a c++ software what to do off the id and then button.
#include "KeyFob.h"
KeyFob fob;
SYSTEM_MODE(SEMI_AUTOMATIC);
bool checkFob = false;
void setup() {
//Setup communication to KeyFob interface module
pinMode(A3, INPUT);
attachInterrupt(A3, evalFob, CHANGE);
Serial.begin(9600);
Serial1.begin(9600);
}
void loop() {
//If an interrupt has fired on A3 which is connected to the fob module then a button has been pressed or released so we need to determine what button was pressed or released.
delay(10);
if(checkFob){
checkFob = false;
fob.evalFob();
String action;
// say what you got:
switch(fob.recentAction){
case(fob.button1release):
Serial.print(fob.recentFobID);
Serial.print("1");
break;
case(fob.button2release):
Serial.print(fob.recentFobID);
Serial.print("2");
break;
case(fob.button3release):
Serial.print(fob.recentFobID);
Serial.print("3");
break;
case(fob.button4release):
Serial.print(fob.recentFobID);
Serial.print("4");
break;
case(fob.button5release):
Serial.print(fob.recentFobID);
Serial.print("5");
break;
case(fob.button6release):
Serial.print(fob.recentFobID);
Serial.print("6");
break;
case(fob.button7release):
Serial.print(fob.recentFobID);
Serial.print("7");
break;
case(fob.button8release):
Serial.print(fob.recentFobID);
Serial.print("8");
break;
}
}
}
void evalFob(){
checkFob = true;
}