Giter Site home page Giter Site logo

doimant / button_sl Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 1.0 13 KB

Button is a class for (debouncing) button queries. The included ButtonSL is extended so that a distinction can be made between a short and long button press.

License: MIT License

C++ 100.00%
arduino button button-control debounce debounce-button esp32 esp8266 platformio

button_sl's People

Contributors

dl9sec avatar doimant avatar

Stargazers

 avatar  avatar

Watchers

 avatar

Forkers

dl9sec

button_sl's Issues

Library doesn't compile...

Hi,

unfortunately I couldn't get the library compiled in Arduino IDE 1.8.19 on a Wemos D1 mini (ESP8266) with my code.

First error I got was:

'Button' does not name a type
respectively
'ButtonSL' does not name a type.

I don't know why, but neither the classes nor the enums are recognized (library is installed and included correctly, I can see in the compiler output, that it is recognized as an include).

BTW: keyword contains an error ("ButtonLS" instead of "ButtonSL" as keyword)...

Regards, Thorsten

First read of button with .tick() doesn't seem to work...

Hi,
I have an application where I use two buttons in the startup phase to initialize an EEPROM.

So I declared the buttons with:

// Buttons
using namespace Btn;

Button   btnAntUp{DI_ANTUP, LOW};        // AntUp button with pull-up, active low
Button   btnAntDn{DI_ANTDN, LOW};        // AntDn button with pull-up, active low

(where DI_ANTUP is 12 and DI_ANTDN is 13 on my Wemos D1 mini).

After initializing in setup() with

btnAntUp.begin();
btnAntDn.begin();

I tried to initialize the EEPROM when both buttons are pressed at the same time:

if ( btnAntUp.tick() && btnAntDn.tick() )
{
   // Initialize EEPROM here
}

Unfortunately the first read of the buttons alway seems to return 0, so I never get the EEPROM to be initialized when both buttons were pressed at startup.

A workaround for me was to do a dummy read after the init:

btnAntUp.begin();  btnAntUp.tick();
btnAntDn.begin();  btnAntDn.tick();

After this dummy read, the if condition is true if both buttons are pressed and the code between the braces is executed as expected.

I assume, that this isn't the expected behaviour of the .tick() method, isn't it?

Regards, Thorsten

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.