You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-4Lines changed: 7 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,11 +17,11 @@ Available as [Arduino library "EasyButtonAtInt01"](https://www.arduinolibraries.
17
17
Debouncing is merely done by ignoring a button change within the debouncing time (default 50 ms).
18
18
So **button state is instantly available** without debouncing delay!
19
19
- Implements **toggle button** functionality.
20
-
- Support for **double press detection** is included. See [EasyButtonExample](examples/EasyButtonExample/EasyButtonExample.ino#L112) and [Callback example](examples/Callback/Callback.ino#L78).
21
-
- Support for **long press detection**, is included. See [Callback example](examples/Callback/Callback.ino#L98).
20
+
- Support for **double press detection** is included. See [EasyButtonExample](examples/EasyButtonExample/EasyButtonExample.ino#L111) and [Callback example](examples/Callback/Callback.ino#L77).
21
+
- Support for **long press detection**, is included. See [Callback example](examples/Callback/Callback.ino#L97).
22
22
- Support for **active high buttons**.
23
23
- Small memory footprint.
24
-
- Support to **measure maximum bouncing period of a button**. See [DebounceTest example](examples/DebounceTest/DebounceTest.ino#L64).
24
+
- Support to **measure maximum bouncing period of a button**. See [DebounceTest example](examples/DebounceTest/DebounceTest.ino#L62).
25
25
26
26
## Table of available pins for the 2 buttons
27
27
| CPU | Button 0 | Button 1 using INT1 | Button 1 using PCINT, if INT1_PIN is defined !=3 |
@@ -154,7 +154,7 @@ Modify them by enabling / disabling them, or change the values if applicable.
154
154
| `USE_BUTTON_1` | disabled | Enables code for button at INT1 (pin3 on 328P, PA3 on ATtiny167, PCINT0 / PCx for ATtinyX5). |
155
155
| `BUTTON_IS_ACTIVE_HIGH` | disabled | Enable this if you buttons are active high. |
156
156
| `USE_ATTACH_INTERRUPT` | disabled | This forces use of the arduino function attachInterrupt(). It is required if you get the error "multiple definition of \`__vector_1'" (or \`__vector_2'), because another library uses the attachInterrupt() function. |
157
-
| `NO_BUTTON_RELEASE_CALLBACK` | disabled | Disables the code for release callback. This saves 2 bytes RAM and 64 bytes FLASH. |
157
+
| `NO_BUTTON_RELEASE_CALLBACK` | disabled | Disables the code for release callback. This saves 2 bytes RAM and 64 bytes program space. |
158
158
| `BUTTON_DEBOUNCING_MILLIS` | 50 | With this you can adapt to the characteristic of your button. |
159
159
| `ANALYZE_MAX_BOUNCING_PERIOD` | disabled | Analyze the buttons actual debounce value. |
160
160
| `BUTTON_LED_FEEDBACK` | disabled | This activates LED_BUILTIN as long as button is pressed. |
* Double press (< 200 ms) detection by calling checkForForDoublePress() once at button press time.
79
-
* Be aware, that the first press after booting may be detected as double press!
80
-
* This is because the "last time of press" is initialized with 0 milliseconds, which is interpreted as the first press happened at the beginning of boot.
Copy file name to clipboardExpand all lines: examples/EasyButtonExample/EasyButtonExample.ino
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -109,9 +109,7 @@ void loop() {
109
109
110
110
voidhandleButtonPress(bool aButtonToggleState) {
111
111
/*
112
-
* This function works reliable only if called early in press callback function
113
-
* Be aware, that the first press after booting may be detected as double press!
114
-
* This is because the "last time of press" is initialized with 0 milliseconds, which is interpreted as the first press happened at the beginning of boot.
112
+
* checkForDoublePress() works reliable only if called early in press callback function
sentence=Small and easy to use Arduino library for using push buttons at INT0/pin2 and / or any PinChangeInterrupt pin.<br/>Functions for long and double press detection are included.<br/><br/>Just connect buttons between ground and any pin of your Arduino - that's it<br/><br/><b>No call</b> of begin() or polling function like update() required. No blocking debouncing delay.<br/>
6
-
paragraph=<br/>Define an EasyButtonIn in you main program and use <i>ButtonStateIsActive</i> or <i>ButtonToggleState</i> to determine your action.<br/>Or use a <b>callback function</b> which will be called once on every button press or release.<br/><br/>Usage:<pre>#define USE_BUTTON_0<br/>#include "EasyButtonAtInt01.hpp"<br/>EasyButton Button0AtPin2;<br/><br/>void setup() {}<br/>void loop() {<br/>...<br/> digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);<br/>...<br/>}</pre><br/><br/><b>New: </b>Renamed EasyButtonAtInt01.cpp.h to EasyButtonAtInt01.hpp. => <b>You must change: #include "EasyButtonAtInt01.cpp.h" to: #include "EasyButtonAtInt01.hpp"</b><br/>
6
+
paragraph=<br/>Define an EasyButtonIn in you main program and use <i>ButtonStateIsActive</i> or <i>ButtonToggleState</i> to determine your action.<br/>Or use a <b>callback function</b> which will be called once on every button press or release.<br/><br/>Usage:<pre>#define USE_BUTTON_0<br/>#include "EasyButtonAtInt01.hpp"<br/>EasyButton Button0AtPin2;<br/><br/>void setup() {}<br/>void loop() {<br/>...<br/> digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);<br/>...<br/>}</pre><br/><br/><b>New: </b>Avoid mistakenly double press detection after boot.</b><br/>
Copy file name to clipboardExpand all lines: src/EasyButtonAtInt01.h
+5-5Lines changed: 5 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@
12
12
* #include "EasyButtonAtInt01.h"
13
13
* EasyButton Button0AtPin2(true);
14
14
*
15
-
* Copyright (C) 2018 Armin Joachimsmeyer
15
+
* Copyright (C) 2018-2022 Armin Joachimsmeyer
16
16
* armin.joachimsmeyer@gmail.com
17
17
*
18
18
* This file is part of EasyButtonAtInt01 https://github.com/ArminJo/EasyButtonAtInt01.
@@ -34,7 +34,7 @@
34
34
#ifndef EASY_BUTTON_AT_INT01_H_
35
35
#defineEASY_BUTTON_AT_INT01_H_
36
36
37
-
#defineVERSION_EASY_BUTTON"3.2.0"
37
+
#defineVERSION_EASY_BUTTON"3.2.1"
38
38
#defineVERSION_EASY_BUTTON_MAJOR3
39
39
#defineVERSION_EASY_BUTTON_MINOR2
40
40
// The change log is at the bottom of the file
@@ -62,7 +62,7 @@
62
62
/*
63
63
* Define USE_ATTACH_INTERRUPT to force use of the arduino function attachInterrupt().
64
64
* It is required if you get the error " multiple definition of `__vector_1'" (or `__vector_2'), because another library uses the attachInterrupt() function.
65
-
* For one button it needs additional 160 bytes FLASH, for 2 buttons it needs additional 88 bytes.
65
+
* For one button it needs additional 160 bytes program space, for 2 buttons it needs additional 88 bytes.
66
66
*/
67
67
//#define USE_ATTACH_INTERRUPT
68
68
//
@@ -84,7 +84,7 @@
84
84
#endif
85
85
86
86
/*
87
-
* Activate this to save 2 bytes RAM and 64 bytes FLASH
87
+
* Activate this to save 2 bytes RAM and 64 bytes program space
88
88
*/
89
89
//#define NO_BUTTON_RELEASE_CALLBACK
90
90
//
@@ -128,7 +128,7 @@
128
128
#endif
129
129
130
130
/*
131
-
* These defines are here to enable saving of 150 bytes FLASH if only one button is needed
131
+
* These defines are here to enable saving of 150 bytes program space if only one button is needed
Copy file name to clipboardExpand all lines: src/EasyButtonAtInt01.hpp
+12-6Lines changed: 12 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@
15
15
* #include "EasyButtonAtInt01.hpp"
16
16
* EasyButton Button0AtPin2(true);
17
17
*
18
-
* Copyright (C) 2018 Armin Joachimsmeyer
18
+
* Copyright (C) 2018-2022 Armin Joachimsmeyer
19
19
* armin.joachimsmeyer@gmail.com
20
20
*
21
21
* This file is part of EasyButtonAtInt01 https://github.com/ArminJo/EasyButtonAtInt01.
@@ -42,7 +42,7 @@
42
42
* - USE_BUTTON_1 Enables code for button at INT1 (pin3 on 328P, PA3 on ATtiny167, PCINT0 / PCx for ATtinyX5).
43
43
* - BUTTON_IS_ACTIVE_HIGH Enable this if you buttons are active high.
44
44
* - USE_ATTACH_INTERRUPT This forces use of the arduino function attachInterrupt(). It is required if you get the error "multiple definition of __vector_1".
45
-
* - NO_BUTTON_RELEASE_CALLBACK Disables the code for release callback. This saves 2 bytes RAM and 64 bytes FLASH.
45
+
* - NO_BUTTON_RELEASE_CALLBACK Disables the code for release callback. This saves 2 bytes RAM and 64 bytes program space.
46
46
* - BUTTON_DEBOUNCING_MILLIS With this you can adapt to the characteristic of your button.
47
47
* - ANALYZE_MAX_BOUNCING_PERIOD Analyze the buttons actual debounce value.
48
48
* - BUTTON_LED_FEEDBACK This activates LED_BUILTIN as long as button is pressed.
0 commit comments