Search found 6 matches

by grafalex
Mon Apr 09, 2018 1:29 pm
Forum: ESP8266 boards
Topic: pin change interrupt + debouncing
Replies: 18
Views: 4467

Re: pin change interrupt + debouncing

Hi All, Thank you very much for your comments. I ended up with this code. It feels pretty robust import machine import utime pin = machine.Pin(14, machine.Pin.IN, machine.Pin.PULL_UP) new_click_detected = False def callback(p): global new_click_detected new_click_detected = True #pin.irq(trigger=mac...
by grafalex
Sun Apr 08, 2018 7:28 pm
Forum: ESP8266 boards
Topic: pin change interrupt + debouncing
Replies: 18
Views: 4467

Re: pin change interrupt + debouncing

Thank you very much for your code.

I am basically using a polling approach, that was inspired by Peter's Switch class. But I got number of comments from the community that polling is not the best way, so now I am investigating pin change interrupt way.
by grafalex
Sun Apr 08, 2018 2:23 pm
Forum: ESP8266 boards
Topic: pin change interrupt + debouncing
Replies: 18
Views: 4467

Re: pin change interrupt + debouncing

Now what happens if the button gets into a stable state within 30ms? I am capturing value of the first trigger, not the last. I use it that way (but with asyncio) in my application for publishing the bell to mqtt. Could you please show me the code so that I am not reinventing the wheel? (I use uasy...
by grafalex
Sun Apr 08, 2018 1:31 pm
Forum: ESP8266 boards
Topic: pin change interrupt + debouncing
Replies: 18
Views: 4467

pin change interrupt + debouncing

Can someone help me understanding what is wrong with my pin change interrupt handler? I have a button, that is connected between GPIO14 (D5 pin on Wemos D1 mini) and ground. I need to count number of button presses. First I tried to trigger pin change interrupt only on falling edge, but this code of...
by grafalex
Wed Mar 07, 2018 7:55 pm
Forum: Programs, Libraries and Tools
Topic: mqtt_as: program structure questions
Replies: 3
Views: 992

Re: mqtt_as: program structure questions

Hi Peter,

Thank you very much for your answers. This makes things more clear.

I did not know ESP stores WiFi password. This might be tricky to set password for every new board (I mean non-development boards, e.g. sonoff). Not a big deal, though
by grafalex
Sun Mar 04, 2018 5:15 pm
Forum: Programs, Libraries and Tools
Topic: mqtt_as: program structure questions
Replies: 3
Views: 992

mqtt_as: program structure questions

Hi All, I am building an application based on ESP8266 board and mqtt_as framework. I learned examples bundled with https://github.com/peterhinch/micropython-mqtt library, but I still have a few questions. 1) Most (if not all) examples run main functions like this: [code] try: loop.run_until_complete...