Skip to content

Commit

Permalink
Added attachInterrupt() code
Browse files Browse the repository at this point in the history
  • Loading branch information
ArminJo committed Mar 26, 2019
1 parent 1369224 commit 1fc2971
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# EasyButton
Arduino library for handling push buttons at INT0 and / or INT1 pin (pin 2 / 3).<br/>
The library is totally based on interrupt.<br/>
Debouncing is implemented in a not blocking way! It is merely done by ignoring a button change within the debouncing time.
Arduino library for handling push buttons connected between ground and INT0 and / or INT1 pin (pin 2 / 3).<br/>
The library is totally based on interrupt and debouncing is implemented in a not blocking way. It is merely done by ignoring a button change within the debouncing time.

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Build Status](https://travis-ci.org/ArminJo/EasyButtonAtInt01.svg?branch=master)](https://travis-ci.org/ArminJo/EasyButtonAtInt01)
Expand Down
3 changes: 1 addition & 2 deletions examples/OneButton/OneButton.ino
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,12 @@ EasyButton Button0AtPin2(true);

void setup() {
// initialize the digital pin as an output.
pinMode(LED_BUILTIN, OUTPUT);
// pinMode(LED_BUILTIN, OUTPUT); // not needed here, since it is done by button library
Serial.begin(115200);
while (!Serial)
; //delay for Leonardo
// Just to know which program is running on my Arduino
Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__));

}

void loop() {
Expand Down
8 changes: 4 additions & 4 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=EasyButtonAtInt01
version=1.0
version=1.0.0
author=Armin Joachimsmeyer
maintainer=Armin Joachimsmeyer <[email protected]>
sentence=Arduino library for handling push buttons at INT0 and / or INT1 pin (pin 2 / 3)
paragraph=Just attach buttons to pin 2 or 3 of your Arduino - thats it. In you main program define a EasyButton and use ButtonStateIsActive or ButtonToggleState to determine your action. Or use a callback function called once on every button press. If timing does matter, 3 more variables are available: ButtonPressDurationMillis, ButtonLastChangeMillis and ButtonReleaseMillis.
category=Input
sentence=Small and easy to use Arduino library for using push buttons at INT0 and / or INT1 pin (pin 2 / 3) using interrupts.<br/>No call of begin() or update() function needed. No blocking debouncing.<br/><br/>
paragraph=Just connect buttons between ground and pin 2 or 3 of your Arduino - thats it.<br/><br/>In you main program define an EasyButton and use <i>ButtonStateIsActive</i> or <i>ButtonToggleState</i> to determine your action.<br/>Or use a callback function which will be called once on every button press.<br/><br/>Usage:<pre>#define USE_BUTTON_0<br/>#include "EasyButtonAtInt01.h"<br/>EasyButton Button0AtPin2(true);<br/><br/>void setup() {}<br/>void loop() {<br/>...<br/> digitalWrite(LED_BUILTIN, Button0AtPin2.ButtonToggleState);<br/>...<br/>}</pre><br/>If button timing is of interest, 3 variables are available:<ul><li>ButtonPressDurationMillis</li><li>ButtonLastChangeMillis</li><li>ButtonReleaseMillis</li></ul>
category=Signal Input/Output
url=https://github.com/ArminJo/EasyButtonAtInt01
architectures=avr
2 changes: 1 addition & 1 deletion src/EasyButtonAtInt01.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
* EasyButtonAtInt01.h
*
* Arduino library for handling push buttons at INT0 and / or INT1 pin (pin 2 / 3).
* Arduino library for handling push buttons connected between ground and INT0 and / or INT1 pin (pin 2 / 3).
* The library is totally based on interrupt.
* Debouncing is implemented in a not blocking way! It is merely done by ignoring a button change within the debouncing time.
*
Expand Down

0 comments on commit 1fc2971

Please sign in to comment.