Compare commits

...
3 changed files with 81 additions and 28 deletions
+51
View File
@@ -0,0 +1,51 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
+25 -28
View File
@@ -1,36 +1,36 @@
# BOUNCE 2
# Bounce2
Debouncing library for Arduino and Wiring by Thomas Ouellet Fredericks and many [contributors](https://github.com/thomasfredericks/Bounce2/graphs/contributors).
The mechanical part of buttons and switches vibrate slightly when closed or opened causing multiple undesired false states (similar to noise). This library filters out these undesired state changes. You can learn more about debouncing here:
* John Errington's Experiments with an Arduino : [Using digital inputs: Switch bounce and solutions to it](http://www.skillbank.co.uk/arduino/switchbounce.htm)
* Wikipedia article : http://en.wikipedia.org/wiki/Debounce#Contact_bounce
* [John Errington's Experiments with an Arduino - Using digital inputs: Switch bounce and solutions to it](http://www.skillbank.co.uk/arduino/switchbounce.htm)
* [Wikipedia article on contact Debouncing](http://en.wikipedia.org/wiki/Debounce#Contact_bounce)
The library is composed of three classes:
* Bounce2::Button : The most feature rich class for deboucing hardware buttons. The one that most people will use.
* Debouncer : The code that does the actual debouncing. Only advanced users should play with this class.
* Bounce : This class links the Debouncer to a hardware pin on your board. It is odly named because it needs to be backward compatible to previous versions of this library.
* `Bounce2::Button` : The class that most people will use. It is the most feature rich class for deboucing hardware buttons.
* `Debouncer` : The code that does the actual debouncing. Only advanced users should use this class for creating their own implememtations.
* `Bounce` : This class links the `Debouncer` class to a hardware pin on your board. It is odly named because it needs to be backward compatible to previous versions of this library.
# HAVE A QUESTION?
# Need Help?
Please post your usage questions on the [Arduino Forums](https://forum.arduino.cc/latest).
# INSTALLATION & DOWNLOAD
# Installation
Install through your software's Library Manager or download the latest version [here](https://github.com/thomasfredericks/Bounce2/archive/master.zip) and put the "Bounce2" folder in your "libraries" folder.
Please note that the original version of this library (Bounce 1) is included in the "extras" folder of the download but not supported anymore.
# BASIC USE
# Basic Use
## ADD TO THE GLOBAL SPACE
## Global Space
```cpp
#include <Bounce2.h>
Bounce2::Button button = Bounce2::Button(); // INSTANTIATE A Bounce2::Button OBJECT
```
## CONFIGURE IN SETUP()
## Configuration in `setup()`
In the code sample below :
* Change *PIN* to the hardware pin of the button.
@@ -45,7 +45,7 @@ button.setPressedState( PRESSED_STATE );
```
## USE IN LOOP()
## Use in `loop()`
```cpp
// UPDATE THE BUTTON BY CALLING .update() AT THE BEGINNING OF THE LOOP:
@@ -57,13 +57,9 @@ if ( button.pressed() ) {
}
```
# Examples
# EXAMPLES
You can find many examples in the **examples** folder.
## EXAMPLE OF Bounce2::Button TOGGLING THE STATE OF A LED
## A Button Toggling a LED
```cpp
/*
@@ -137,7 +133,11 @@ void loop() {
}
```
# DOCUMENTATION
## More Examples
You can find more examples in the **examples** folder.
# Documentation
## Bounce2::Button
@@ -183,7 +183,7 @@ The `Bounce` class extends `Debouncer` and links it to a hardware pin. This clas
## Debouncer
The `Debouncer` class. Just the debouncing code separated from all harware.
The `Debouncer` class. Just the debouncing code separated from all hardware.
| Method | Description |
| --------------- | --------------- |
@@ -197,21 +197,18 @@ The `Debouncer` class. Just the debouncing code separated from all harware.
| `bool` `fell()` | Returns true if pin signal transitions from high to low since the last update. |
| `bool` `rose()` | Returns true if pin signal transitions from low to high since the last update. |
# GITHUB PAGE (SOURCE CODE)
https://github.com/thomasfredericks/Bounce2
# Alternate Algorithms
The following alternate debouncing algorithms are for **advanced** users or specific cases.
# ALTERNATE DEBOUNCE ALGORITHMS FOR **ADVANCED** USERS AND SPECIFIC CASES
## STABLE INTERVAL
## Stable Interval
By default, the Bounce library uses a stable interval to process the debouncing. This is simpler to understand and can cancel unwanted noise.
![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_stable.png)
## LOCK-OUT INTERVAL
## Lock-out Interval
By defining "#define BOUNCE_LOCK_OUT" in "Bounce.h" you can activate an alternative debouncing method. This method is a lot more responsive, but does not cancel noise.
@@ -221,7 +218,7 @@ By defining "#define BOUNCE_LOCK_OUT" in "Bounce.h" you can activate an alternat
![](https://raw.github.com/thomasfredericks/Bounce-Arduino-Wiring/master/extras/BouncySwitch_lockout.png)
## WITH PROMPT DETECTION
## Prompt Detection
By defining "#define BOUNCE_WITH_PROMPT_DETECTION" in "Bounce.h" you can activate an alternative debouncing method. Button state changes are available immediately so long as the previous state has been stable for the timeout period. Otherwise the state will be updated as soon as the timeout period allows.
+5
View File
@@ -0,0 +1,5 @@
title: Bounce2 Arduino & Wiring Library
description: Debouncing library for Arduino and Wiring.
show_downloads: true
google_analytics:
theme: jekyll-theme-leap-day