On Saturday, February 24, 2018 at 1:57:59 AM UTC-8, A. Dumas wrote:
> On 20/02/2018 06:22, Dennis Lee Bieber wrote:
> > newState = readPin()
> > if lastState == closed and newState == opened:
> > print opened
> > elif lastState == opened and newState == closed:
> > print closed
> > lastState = newState
>
> oldState = None
> while True:
> newState = readPin()
> if newState != oldState:
> print(newState)
> oldState = newState
> sleep(1)
Hello A Dumas -
Thanks to all who commented and replied. I have implemented a scheme much like
the one above from A. Dumas. It works fine. I am considering using an
interrupt - but will reply to note below.
Thanks Again,
ewholz
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|