doimant / button_sl Goto Github PK
View Code? Open in Web Editor NEWButton 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
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
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
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.