thingstodo
Member
For my boat I'm designing a whole new control panel. Every piece of equipment to be controlled with just one (flip-flop) button.
For the windscreen wiper, I'm almost there. Just one little annoying problem to solve. The way it should work:
Momentary Push Button x1,
push 1 -> starts with speed 1
push 2 -> toggles to speed 2
push 3 -> toggles to speed 1
push 4 -> toggles to speed 2
and so on, until it stops raining..:
keep push button pressed for 2 seconds -> wiper switches off
What I've done is almost good, but at that 2 seconds push, it instantly toggles speed before it switches off. I know why , but I don't know how to prevent that last toggle. Anyone that has a solution?
I'm quite a novice with PLC, so my setup is very straightforward, but at least this is simple to understand (for me).
Lots of good ideas posted here. I think all of them will work fine.
But I don't see a simple debounce on the input ... maybe I missed that? Mechanical switches bounce (make-break-make-break ...) before stablilizing ON
I think that is what is messing with your code. It just runs too fast.
I think your original code would work fine if you debounce your input for maybe 50 ms or 100 ms, then use the DONE output of the timer instead of the direct input for your logic.
As a rule of thumb, I debounce all inputs to internal storage once per scan, execute my logic based on the internal storage, generate outputs in storage, then copy the output storage to hard outputs once per scan
It makes a lot of gremlins disappear