1 (edited by Ghostwarrior 2022-07-23 01:42:21)

Topic: Synchronize Physical Switch(Latched type) and RemoteXY widget Switch

Hi I have a project with a relay controlling from both Physical switch(Latched type) as well as Remotexy app widget switch (i.e when wifi not available or internet fail) the problem is  both are same status when I try to operate physical switch and app widget switch also on but unable to control from both switch independently(Physical switch & Widget switch) on/off with synchronize state. my Code is below, Bypass is Physical switch and BypSwitch_1 is widget switch, Adavance thanks for your help....

if (digitalRead(Bypass) == LOW || RemoteXY.BypSwitch_1==1)
  {
    digitalWrite(PIN_BYPSWITCH_1,HIGH);
    RemoteXY.BypLed = 1;
    RemoteXY.BypSwitch_1=1; 
  }
  if(digitalRead(Bypass) == HIGH || RemoteXY.BypSwitch_1==0)
  {
    
    digitalWrite(PIN_BYPSWITCH_1,LOW);
    RemoteXY.BypLed = 0;
    RemoteXY.BypSwitch_1=0;
  }
digitalWrite(PIN_BYPSWITCH_1, (RemoteXY.BypSwitch_1==0)?LOW:HIGH);