Skip to content

Commit 7f73a4c

Browse files
committed
Update README.md
1 parent 33fc9e9 commit 7f73a4c

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

README.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Toggle
2-
## About
1+
2+
3+
4+
5+
# Toggle [![arduino-library-badge](https://www.ardu-badge.com/badge/Toggle.svg?)](https://www.ardu-badge.com/Toggle) [![PlatformIO Registry](https://badges.registry.platformio.org/packages/dlloydev/library/Toggle.svg)](https://registry.platformio.org/libraries/dlloydev/Toggle)
36

47
Arduino switch and button library for SPST, SPDT or SP3T contacts. Simple to use, provides debouncing, deglitching and uses very little memory. Status indicates one-shot transitions (depicting direction) and current position status.
58

@@ -12,6 +15,8 @@ Arduino switch and button library for SPST, SPDT or SP3T contacts. Simple to use
1215

1316
## Using Toggle
1417

18+
Simple to use because pinMode, input pullups, de-glitch period, bounce period, and switch type (1 or 2 inputs) is automatically detected and configured.
19+
1520
Declaring a switch or button using 1 digital pin for SPST or SPDT contacts:
1621

1722
```c++
@@ -24,7 +29,7 @@ Declaring a switch or button using 2 digital pins for SP3T contacts:
2429
Toggle sw2(7, 8); // GPIO 7 and 8
2530
```
2631

27-
The library sets the pin in input mode with pull-up resistor enabled. All switches have to be polled in the `loop()` function.
32+
Each switch is polled in the `loop()` function:
2833

2934
```c++
3035
sw1.poll();
@@ -97,14 +102,22 @@ void loop() {
97102
98103
Switching between GND and digital pin is the default solution used by this library. External pull-up resistors can be added if desired, but the internal pullups should be sufficient for most applications. What might be of consideration is providing sufficient wetting current to overcome switch contact oxidation.
99104
100-
A set of connections are shown where 0.1μF capacitors are added to provide the following benefits:
105+
A set of connections are shown where 0.1μF capacitors are optionally added to provide the following benefits:
101106
102107
- contact wetting current
103108
- hardware signal filtering
104109
- beneficial for interrupt applications
105110
- improves noise immunity when using longer cables
106111
107-
Connections shown below are for 3-position switches, both without and with capacitors installed. Note: Connections for basic SPST or SPDT buttons or switches requiring only 1 input are similar and not shown.
112+
#### Connections shown below are for 2-position switches (SPST, SPDT, DPDT) using 1 input:
113+
114+
![image](https://user-images.githubusercontent.com/63488701/166920176-7bd21bb6-10f9-4cd1-9467-0c2289e698c5.png)
115+
116+
![image](https://user-images.githubusercontent.com/63488701/166920355-3edac199-4aae-4615-a790-152c2f3acec5.png)
117+
118+
119+
120+
#### Connections shown below are for 3-position switches (SP3T, DP3T) using 2 inputs:
108121
109122
110123

0 commit comments

Comments
 (0)