Once again my coding skills are letting me down and I’m having a hell of a rare old time with the code for a garage door opener. It works fine with the Remote Fob, the receiver output is a momentary High signal over two outputs defined as RemoteUp and Remote Down.
This all works fine, but what I want to do is to introduce a WiFi Device which has a SPCO relay output which Latches to either state. This Latching condition is what is causing me major headaches as what it is doing preventing the Fob Inputs from working correctly.
Ideally some sort of code which will convert the latching condition from the WiFi switch to a momentary One Shot over both WiFi_Input1 and WiFi_Input2
Or another way of writing the code to make it ignore the Latching inputs. As always, any help would be most appreciated.
This is the offending part of the code so far, The full code is attached below.
ProgLedGrn=0ProgLedRed=0Main:
DoforeverIfRemoteUp=1Thenopen_doorWait500ms' this wait may not be needed and is only for not retriggering the subElseIfRemoteDown=1Thenclose-doorWait500ms' this wait may not be needed and is only for not retriggering the subElseIfWiFi_Input1=1AndOld_WIFI=0Then' You realy only need one of the WIFI inputs because they are always oppositeOld_WIFI=1open_doorElseIfWiFi_Input1=0AndOld_WIFI=1ThenOld_WIFI=0close_doorEndIfLoopsubopen_doorProgLedGrn=1ProgLedRed=0PulseOutShutterUp, 1sec'Turn ShutterUp on for 1 sec .. time can be also ms like 500 ms endsubsubclose_doorProgLedGrn=0ProgLedRed=1PulseOutShutterDown, 1sec'Turn ShutterDown on for 1 secendsub
I have not compiled this but only suggesting program flow.
GL
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you Mike, sorry for not getting back to you sooner, I'm having some PC issues which I'm sure a good kick in the USB's wouldn't go amiss. To be honest it is probably so full of my cr@p it is damn near full.
That's an interesting routine and one I'm keen to try out.
One thing that I have found in the WiFi App is that it is possible to program it to give a momentary one shot.
To confuse the issue they have called it "Inching" and the inching duration can be adjusted down as low 500 mS which with some jiggling around with the code make work without the issues it is giving me previously.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you Mike, sorry for not getting back to you sooner, I'm having some PC issues which I'm sure a good kick in the USB's wouldn't go amiss. To be honest it is probably so full of my cr@p it is damn near full.
That's an interesting routine and one I'm keen to try out.
One thing that I have found in the WiFi App is that it is possible to program it to give a momentary one shot.
To confuse the issue they have called it "Inching" and the inching duration can be adjusted down as low 500 mS which with some jiggling around with the code make work without the issues it is giving me previously.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keith,
Most garage door remotes I have been associated with are only "one button" , one output. push it to go up when it is down. push it to close when it is open.
Yours has an up button and down button. So does your wifi receiver have two relays?
If it does then you would not even need a PIC to arbitrate and give an output. the relays could be wired as OR logic and you would be done.
Best Regards
Mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Once again my coding skills are letting me down and I’m having a hell of a rare old time with the code for a garage door opener. It works fine with the Remote Fob, the receiver output is a momentary High signal over two outputs defined as RemoteUp and Remote Down.
This all works fine, but what I want to do is to introduce a WiFi Device which has a SPCO relay output which Latches to either state. This Latching condition is what is causing me major headaches as what it is doing preventing the Fob Inputs from working correctly.
Ideally some sort of code which will convert the latching condition from the WiFi switch to a momentary One Shot over both WiFi_Input1 and WiFi_Input2
Or another way of writing the code to make it ignore the Latching inputs. As always, any help would be most appreciated.
This is the offending part of the code so far, The full code is attached below.
Last edit: Keith 2022-01-15
Full code
Clearly I do not fully understand the issue but from my scan - I would recommend a state engine using select-case removing all the Do-Whiles.
How about something like this
I have not compiled this but only suggesting program flow.
GL
Mike
Thank you Mike, sorry for not getting back to you sooner, I'm having some PC issues which I'm sure a good kick in the USB's wouldn't go amiss. To be honest it is probably so full of my cr@p it is damn near full.
That's an interesting routine and one I'm keen to try out.
One thing that I have found in the WiFi App is that it is possible to program it to give a momentary one shot.
To confuse the issue they have called it "Inching" and the inching duration can be adjusted down as low 500 mS which with some jiggling around with the code make work without the issues it is giving me previously.
Thank you Mike, sorry for not getting back to you sooner, I'm having some PC issues which I'm sure a good kick in the USB's wouldn't go amiss. To be honest it is probably so full of my cr@p it is damn near full.
That's an interesting routine and one I'm keen to try out.
One thing that I have found in the WiFi App is that it is possible to program it to give a momentary one shot.
To confuse the issue they have called it "Inching" and the inching duration can be adjusted down as low 500 mS which with some jiggling around with the code make work without the issues it is giving me previously.
Keith,
Most garage door remotes I have been associated with are only "one button" , one output. push it to go up when it is down. push it to close when it is open.
Yours has an up button and down button. So does your wifi receiver have two relays?
If it does then you would not even need a PIC to arbitrate and give an output. the relays could be wired as OR logic and you would be done.
Best Regards
Mike