77</p >
88
99# EZButton
10- Arduino library that Transform raw button/touch inputs into events easily.
10+ Arduino library that transforms raw button/touch inputs into events easily.
1111
12- Subscibe to Pressed/Released/Hold/HoldReleased events of as many buttons as you want. Customize time tresholds . Works with any button read method.
12+ Subscribe to Pressed/Released/Hold/HoldReleased events with as many buttons as you want. Customize time thresholds . Works with any button read method.
1313
1414## Features
1515- Flexibility
@@ -20,28 +20,32 @@ Subscibe to Pressed/Released/Hold/HoldReleased events of as many buttons as you
2020 - Also works with:
2121 - Pulling
2222 - Multiplexing
23- - Interupts
23+ - Interrupts
2424 - AnalogReads
2525 - etc
26- - Event Subscibtion : You can subscribe to any of the following events for any button:
26+ - Event Subscription : You can subscribe to any of the following events for any button:
2727 - Pressed
2828 - Released
2929 - Hold
3030 - Hold Released
31- - Unlimited Buttons/Touches : You can config for as many buttons as you need.
32- - Customizability: You can change any of the time tresholds to customize you user experience.
33- - ` HoldTreshHold ` : The time it takes before the first ` HOLD ` event is executed after button is held down.
34- - ` HoldInterval ` : The Time Interval that corresponds to ` HOLD ` event being executed repeatedly after the first ` HOLD ` event was registerd .
35- - Debugging : Easily enable/disable debugging for all button states and events.
31+ - Unlimited Buttons/Touches: You can configure as many buttons as you need.
32+ - Customizability: You can change any of the time thresholds to customize your user experience.
33+ - ` HoldTreshHold ` : The time it takes before the first ` HOLD ` event is executed after the button is held down.
34+ - ` HoldInterval ` : The Time Interval that corresponds to the ` HOLD ` event being executed repeatedly after the first ` HOLD ` event was registered .
35+ - Debugging: Easily enable/disable debugging for all button states and events.
3636- Blackout Time: Disable any event execution for any amount of time.
3737
3838## How To
3939### Installation
4040This Library is available in ` Arduino Library Repository ` and ` PIO ` and you can install it from:
4141- Arduino IDE Library Manager
42+
4243![ arduino library manager] ( image-1.png )
44+
4345- PlatformIO Libraries
46+
4447![ pltformio library] ( image.png )
48+
4549` ipdotsetaf/EZButton@^2.3.0 `
4650### Usage
4751
@@ -61,7 +65,7 @@ This Library is available in `Arduino Library Repository` and `PIO` and you can
6165// HoldInterval: 300ms
6266EZButton _ezb (4, ReadButtons, 500, 300);
6367```
64- 3. Initialize you buttons/touches however you want.
68+ 3. Initialize your buttons/touches however you want.
65694. Attach any Interrups if needed.
66705. Subscribe to any event you need
6771``` C++
@@ -74,13 +78,13 @@ _ezb.Subscribe(BTN_4, Btn4Hold, HOLD);
7478_ezb.Subscribe(BTN_4, Btn4Release, RELEASED);
7579```
7680> [ !IMPORTANT]
77- > ` button index ` stands for an array inside EZButton that holds your button states and IS NOT pin number of the button.
81+ > ` button index ` stands for an array inside EZButton that holds your button states and IS NOT PIN of the button.
7882
79836 . Define ` ReadButtons ` function
8084``` C++
8185void ReadButtons (bool * states, int num)
8286{
83- //Read all button states however you want
87+ //Read all button states however you want
8488 states[ BTN_1] = !digitalRead(2);
8589 states[ BTN_2] = touchRead(3) <= 50;
8690 states[ BTN_3] = touchRead(4) <= 50;
@@ -91,7 +95,7 @@ void ReadButtons(bool *states, int num)
9195``` C++
9296void loop()
9397{
94- //...
98+ //...
9599
96100 _ezb.Loop();
97101}
@@ -101,18 +105,18 @@ void loop()
101105> #### Debugging
102106> In order to enable debugging, you need to add the ` -DEZBUTTON_DEBUG ` parameter to your ` build_flags ` .
103107>
104- > This will log event subscibtions and event executions to the serial.
108+ > This will log event subscriptions and event executions to the serial.
105109
106110> [ !IMPORTANT]
107- > Right now only one subscribtion is possible for each button event.
111+ > Right now only one subscription is possible for each button event.
108112>
109- > e.g. You can only subscribe to the ` PRESSED ` event of ` BTN_2 ` once and the second subscribtion to this event will override the last one.
113+ > e.g. You can only subscribe to the ` PRESSED ` event of ` BTN_2 ` once and the second subscription to this event will override the last one.
110114>
111- > You can still subscribe to other events of the same button with no problem.
115+ > You can still subscribe to other events with the same button with no problem.
112116
113117## TODO:
114118- Rewrite in C
115- - Add multiple subscribtions to a single event
119+ - Add multiple subscriptions to a single event
116120
117121## Contribution
118122- You can open Issues for any bug report or feature request.
0 commit comments