Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By schufti
#24501 Hi,
I have the OneButton-lib running on an original arduino with no problem.
As I found no specific AVR related code, I thought it save to use on ESP8266, too.
But unfortunately it isn't really useable, when you press a key it randomly detects a mix of one or more single and double clicks.
I allready changed OneButtop.cpp
Code: Select all  pinMode(pin, INPUT);      // sets the MenuPin as input
....
    digitalWrite(pin, HIGH);   // turn on pullUp resistor

to
Code: Select all  pinMode(pin, INPUT_PULLUP);      // sets the MenuPin as input w pullup

and disabled WiFi (WiFi.mode(WIFI_OFF)) to see if some "internal" things interfere with the OneButton timing but to no avail.

Can someone "in the know" have a look if I am missing something obvious?
Maybe reccomend a known working lib with similar functionality?

thanx a lot,
schufti
Last edited by schufti on Tue Aug 18, 2015 6:15 am, edited 1 time in total.
User avatar
By rvtk
#24517 Which version of the ESP8266 Arduino IDE are you using? Try upgrading to the most recent version.

Recently the accuracy/behavior of millis() changed (which is used extensively by the OneButton lib), so maybe now it works. A similar issue was encountered in an topic about 433mhz senders/receivers, see viewtopic.php?f=13&t=2507.
User avatar
By andrew melvin
#24531 I was interested in this lib, so downloaded it and gave it a shot.

Using one of the examples, I removed the wait for serial line, changed the pin from A1 to 0, and uploaded it to my nodemcu devboard.

Worked first time, detects all three types easily.
I am using the latest staging version of the IDE.

https://www.dropbox.com/s/0xy5tu4q0agcv ... 9.png?dl=0
User avatar
By schufti
#24610 Hi,
thank you for the hint with the staging version, it's working like a charm now*.
yes, it's a very helpfull little lib for simplistic "user interface" like setting a clock etc.

thx to the community,
schufti

*Edit: no, not really. It is working with the example but not in my sketch that I want to move from arduino mini to esp8266 to get "time" w/o extra rtc :)