Skip to content

Commit e6d609c

Browse files
committed
Documentation updates.
Documentation updates.
1 parent bb087e1 commit e6d609c

2 files changed

Lines changed: 7 additions & 8 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ButtonSuite
22

3-
A library for adding functionality to push (momentary) buttons. This library allows a simple momentary push button to be used as a momentary button, latching button, counter, or enumerator. This library uses the Bounce2 library to add debouncing functionality.
3+
A library for adding functionality to simple mechanical push (momentary) buttons. This library allows a simple momentary push button to be used as a momentary button, a latching button, a counter, or an enumerator. This library uses the Bounce2 library to add debouncing functionality.
44

55
## Types of Buttons
66
This library contains two categories of button types. The first category is two state buttons; these are either on or off. The second category provides incrementing buttons that can perform different types of counting. These two categories of buttons are described here. See "Software Design" below for information about how the source code implements these behaviors.

examples/SwitchRunTimeBahavior_Demo_01/SwitchRunTimeBahavior_Demo_01.ino

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
two alternating time frames. During the first, the button will turn the LED on
44
and off. During the second, the LED will remain on and the button will have no
55
effect. The two modes are toggled back and forth every few seconds.
6+
7+
To be able to switch buttons (and, therefore, behavior) during runtime, the
8+
interface function "getStatus" must be used. Some buttons like MomentaryButton
9+
have alternate, easier to use, interfaces and those cannot be used for this method.
610
711
The button should be wired such that when pressed, the "buttonPin" is
812
connected to ground.
@@ -19,7 +23,6 @@
1923
int buttonPin = 8;
2024
int ledPin = 9;
2125

22-
2326
// We will access the button through a pointer. That way we can change the button
2427
// behavior by changing what type of button is being pointed to.
2528
SimpleButton *button;
@@ -36,7 +39,6 @@ unsigned long intervalStartTime;
3639
const int intervalLength = 5000;
3740
int currentState;
3841

39-
4042
void setup()
4143
{
4244
// Setup the output LED.
@@ -55,25 +57,22 @@ void setup()
5557
Serial.println("Serial monitor initialized.");
5658
}
5759

58-
5960
void loop()
6061
{
6162
if (millis() - intervalStartTime > intervalLength)
6263
{
63-
64-
6564
// Toggle between the two states. In state 0, the button can turn the LED
6665
// on or off. In state 1, the LED is always on.
6766
if (currentState == 0)
6867
{
69-
// Were in state 0, so switch to state 1.
68+
// We're in state 0, so switch to state 1.
7069
button = &onButton;
7170
currentState = 1;
7271
Serial.println("Current state: ALWAYS ON");
7372
}
7473
else
7574
{
76-
// Were in state 1, so switch to state 0.
75+
// We're in state 1, so switch to state 0.
7776
button = &momentaryButton;
7877
currentState = 0;
7978
Serial.println("Current state: BUTTON");

0 commit comments

Comments
 (0)