jsc-electronics / objectbutton Goto Github PK
View Code? Open in Web Editor NEWAn Arduino library for detecting button actions.
License: Apache License 2.0
An Arduino library for detecting button actions.
License: Apache License 2.0
For example, define a variable t_doubleclick, where if a click event occurs and then a second click event at time t <t_doubleclick, this signal sequence will be considered a double click.
C++ standard has no definition of a method. Documentation should be modified accordingly.
millis()
counter overflows after 50 days. We should compare a time difference from an absolute value. Tests should be written to cover this case.
Add support for analog button/sensor auto-calibration mode. When program starts, user will be asked to press button 1..N. For each button we detect voltage level and set it as a button property.
At the moment, user needs to figure out these values by himself.
M5stack library has a Button
class, as does our library. To avoid name collisions, we've moved our library into jsc
namespace. Under normal circumstances, it's ok to declare following line:
#include <...>
using namespace jsc;
However, when you include M5stack library and our library, it is important to keep our code inside jsc namespace to make a clear distinction between two Button
classes. We should add an example how it should be done.
Note: ArduinoCI allows to specify dependencies only for selected examples. Only this example should have M5stack
as a dependency. It's specified in a local .arduino-ci.yaml
file.
Analog buttons will usually share the same pin. At the moment, we allow setting pin and inputPullUp flag for each button individually. This is not correct. Imagine that one button sets pin as inputPullUp and another sets the same pin to input only.
Builder pattern should solve this problem by not allowing to setup this flag on each individual button. Take into consideration memory restrictions.
Is your feature request related to a problem? Please describe.
I wonder if this is possible to adapt your library to support multiple buttons in the same analog Pin.
Some other library implemented such design (https://github.com/rlogiacco/AnalogButtons), but doesn't handle the evens the way you do it and I wonder if there might be a way to do it using your library.
Describe the solution you'd like
Provide the ability to use an analog PIN, then allow a button to be configured with an activation value that triggers it (between 0 and 1024, based on the resistor associated with the button with a margin for resistor variance).
Additional context
I tried to do it myself but I'm clearly lacking knowledge... Do you think this can be done ?
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.