Hi Terry

I've come into this a bit late I know, but get the impression things are getting rather involved to read some switches, although I may have got the wrong end of the stick.

You don't need hysteresis to read input switches. You just need a pullup resistor and the switch to ground, or a pulldown and switch to Vcc. I prefer the former, as I don't like Vcc wandering around. In the old days of TTL it had to be pullups but that was long ago. Typical CMOS thresholds will be close to mid-rail, but it doesn't really matter.

Simplest way to debounce is scan keys every 100ms or so and on every 1 to 0 transition log a keypress. Typical bounce will be much less than 100ms.

You can get more involved than this if you need auto-repeat, and repeat times are comparable to bounce times, but assuming that's not needed here, we can forget about all that.

If libraries are getting in the way, then there must be a way of reading raw port inputs. Everything is then under your control.

Hope this helps.

Cheers

Tim


On 20/03/17 13:17, Ralph Corderoy wrote:
Hi Terry,

So bounces can reach that simple callback that printed the current time
in your cut-down Python test program?

In the pub, there was mention of daylight savings time.  I can't
remember how the Pi copes, but you said WMT only opens in the summer.
http://www.wimborne-modeltown.com/visitor-information/basic-information/
says

    Wimborne Model Town is open between 1 April and March 19th and 29
    October daily

(They were emailed a while ago about the two start dates.)

Assuming `29 October' is correct, DST will end in the early hours on
that day.  ;-)

    $ for d in 28 29; do date -d "12:00 2017-10-$d"; done
    2017-10-28 12:00:00 +0100 Sat
    2017-10-29 12:00:00 +0000 Sun
    $

Cheers, Ralph.



--
Next meeting:  Bournemouth, Tuesday, 2017-04-04 20:00
Meets, Mailing list, IRC, LinkedIn, ...  http://dorset.lug.org.uk/
New thread:  mailto:dorset@mailman.lug.org.uk / CHECK IF YOU'RE REPLYING
Reporting bugs well:  http://goo.gl/4Xue     / TO THE LIST OR THE AUTHOR

Reply via email to