From 987d751bfa07e1d3f38bc09ffc3d52d6eece3800 Mon Sep 17 00:00:00 2001 From: thomasfredericks Date: Tue, 6 Jan 2015 12:22:41 -0500 Subject: [PATCH] Changed folder structure as requested --- Bounce1.zip | Bin 0 -> 7844 bytes Bounce1/Bounce.cpp | 88 ------------- Bounce1/Bounce.h | 70 ---------- Bounce1/documentation.txt | 13 -- Bounce1/examples/bounce/bounce.pde | 32 ----- Bounce1/examples/change/change.pde | 31 ----- Bounce1/examples/duration/duration.pde | 59 --------- Bounce1/examples/edge/edge.pde | 121 ------------------ Bounce1/examples/rebounce/rebounce.pde | 48 ------- Bounce1/keywords.txt | 30 ----- Bounce2/Bounce2.cpp => Bounce2.cpp | 0 Bounce2/Bounce2.h => Bounce2.h | 0 Bounce2/LICENSE | 20 --- Bounce2/README.md | 9 -- .../examples => examples}/bounce/bounce.ino | 0 .../examples => examples}/change/change.ino | 0 ...rcuit-bounce-change-duration-retrigger.png | Bin .../duration/duration.ino | 0 .../retrigger/retrigger.ino | 0 Bounce2/keywords.txt => keywords.txt | 0 20 files changed, 521 deletions(-) create mode 100644 Bounce1.zip delete mode 100644 Bounce1/Bounce.cpp delete mode 100644 Bounce1/Bounce.h delete mode 100644 Bounce1/documentation.txt delete mode 100644 Bounce1/examples/bounce/bounce.pde delete mode 100644 Bounce1/examples/change/change.pde delete mode 100644 Bounce1/examples/duration/duration.pde delete mode 100644 Bounce1/examples/edge/edge.pde delete mode 100644 Bounce1/examples/rebounce/rebounce.pde delete mode 100644 Bounce1/keywords.txt rename Bounce2/Bounce2.cpp => Bounce2.cpp (100%) rename Bounce2/Bounce2.h => Bounce2.h (100%) delete mode 100644 Bounce2/LICENSE delete mode 100644 Bounce2/README.md rename {Bounce2/examples => examples}/bounce/bounce.ino (100%) rename {Bounce2/examples => examples}/change/change.ino (100%) rename {Bounce2/examples => examples}/circuit-bounce-change-duration-retrigger.png (100%) rename {Bounce2/examples => examples}/duration/duration.ino (100%) rename {Bounce2/examples => examples}/retrigger/retrigger.ino (100%) rename Bounce2/keywords.txt => keywords.txt (100%) diff --git a/Bounce1.zip b/Bounce1.zip new file mode 100644 index 0000000000000000000000000000000000000000..4b6c0cd46b4a6b74e95fcec8320126e39a444acd GIT binary patch literal 7844 zcmai(by!qe7l((Gyo8i=Bi$(~Aq~=ql+@78P|`3U-9v}SNGTvK4blihD=i(;k^;hq za=90b`<*{#o%1|o#|4V zWI4Eb${U!~27O=ZjfoH+C{g;`KtGrA$Tiq2S0DiG8r+pjG@#mi2dbs-t-}|cGgixw zdvCDqM%D$=5JvhhyRi}lXoL{=H4O!q9Y<7Z)^-e3vMBiRX4LR63o|*-IxN>=R!r+T ztgiF+V_3(1)QR24;!8JrJcm#VYCdk|CgwoQF!OW?QjAeWdGiGSV>jN7CcOhbpzrGB z9>FKvgq{RaBYq?Bv*J=zg=4l+BKtfKtFxOr0r7s0#z2$Nu;LIhtCyV4z#xHUoY}(Z zEkj*7;yE1~mn_z7iikK$X3-rqhv%7waIIjoAZd+O6N_PgTz$rG!`RB)A;5-Xl-Dcb z+oWqmUH&$#Muk$#bi1`AS~L{)=FiLAPTm15r^cHR<_!j$;1}aho8u-9g8IBFXQJrDB|B6C431Q<^awW1mzeWm$=eVwOtGA(M0yh$BujZlrE=zS}lV;OrM zckxg@QxQ;0f@8AceSJ*A`^=IdAOZkdr~m-=uVd0IO=H|G&2B<5{)dkQ}?3s0$ws_z*s{;H8Wg z;4d>V+E(bbRJ=37W33aTzL603oL1R zXxZvOoAk4-JtLtqN>=u29_47}J9PZ&QB4(WC5r>gkY;**EyL|}KacrPjb0N2wGLfyDko}MmC1${5+726tNxS*;yCWN zE^+jM;z81z3XQvWzs^WVP!6pQ#xm5AC$pvDC7o=@D6cxn`qWmts7d#|P}3;H!$tRK zMolU2*l?6*(LAsc!S4%8!;}wQb>_(@cP#);pa^*fSYZ<)C3eCMNvWXbtjYRk?~Cr( z8Ir}_mJQId_sDg0%f0!21WWSe>fl~_9)_M!_{U;C<<+6c$Vhz0+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6gq`Y}Zq8AD@Zp6sT(|PZ{WNTEra13r z!ijgy`)&{!zGSK~WoZ;?XP?ot=CN&`!i8zv2w}!OO_Cn+>3hDUWJ!XLpozc@yxS#* zUvW*CQR*HB((W#MJnEi41Ht!2d-33ghD`{68&xkI1_m-D+PbJmG^ClwahejGZWGl! zY(v$Y?l&`J*L0mko802LaW5EF2pnI|Bo;ok+RX5n9XXntZTZ?5k9k2K#$@9movx2smkJJm2;E&QHYOGvF85Yfg4cpqq=WgR$fH*gq}0 z7tK!uyR8?kzS$>1Xptn&TSNsO{l(mnO$B95Nd(09lL>gNbG>H0z5AqobbG1O(R0Kl zW(zelKaQXTOlm0|7Z{YG&dfeB)E&E|6?cS9Mdie6t6v@wKyI6ZFN z*(*4SX9=M5Z;_|YoR6Y=^M2q1hIt3BYhhH&9@(qn9Kn+96bv4nPFhx^Kce%-9EaY1<)&KfeEM`FD2$mo0y9=W3*JLHK?{aFs#B zW%Q%XuX7h|U)rA;*K@pA8P(@Ly!`inGt90M%yKRWm!wPkGvRtt=qh3L{I27Y@Jov5 zDk^^O0(FVJwEv=hbp_5fS1jE47xhn0<|^V<7w|`aUD`ZS+=)YlJ2JGy=V_h;Y?a%tI=LN3n zoBB`ICG=+xs1DlabU|M7m+b=`Nd=Nrv0BlGh7am{y^bNgrev$pHUoU7X2|0nAb`m^sY*ZKd) uy}o;1<*uEF-pin = pin; -} - - -void Bounce::write(int new_state) - { - this->state = new_state; - digitalWrite(pin,state); - } - - -void Bounce::interval(unsigned long interval_millis) -{ - this->interval_millis = interval_millis; - this->rebounce_millis = 0; -} - -void Bounce::rebounce(unsigned long interval) -{ - this->rebounce_millis = interval; -} - - - -int Bounce::update() -{ - if ( debounce() ) { - rebounce(0); - return stateChanged = 1; - } - - // We need to rebounce, so simulate a state change - - if ( rebounce_millis && (millis() - previous_millis >= rebounce_millis) ) { - previous_millis = millis(); - rebounce(0); - return stateChanged = 1; - } - - return stateChanged = 0; -} - - -unsigned long Bounce::duration() -{ - return millis() - previous_millis; -} - - -int Bounce::read() -{ - return (int)state; -} - - -// Protected: debounces the pin -int Bounce::debounce() { - - uint8_t newState = digitalRead(pin); - if (state != newState ) { - if (millis() - previous_millis >= interval_millis) { - previous_millis = millis(); - state = newState; - return 1; - } - } - - return 0; - -} - -// The risingEdge method is true for one scan after the de-bounced input goes from off-to-on. -bool Bounce::risingEdge() { return stateChanged && state; } -// The fallingEdge method it true for one scan after the de-bounced input goes from on-to-off. -bool Bounce::fallingEdge() { return stateChanged && !state; } - diff --git a/Bounce1/Bounce.h b/Bounce1/Bounce.h deleted file mode 100644 index 7be294c..0000000 --- a/Bounce1/Bounce.h +++ /dev/null @@ -1,70 +0,0 @@ - -/* - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301, USA. - */ - - - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * - Main code by Thomas O Fredericks - Rebounce and duration functions contributed by Eric Lowry - Write function contributed by Jim Schimpf - risingEdge and fallingEdge contributed by Tom Harkaway -* * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -#ifndef Bounce_h -#define Bounce_h - -#include - -class Bounce -{ - -public: - // Initialize - Bounce(uint8_t pin, unsigned long interval_millis ); - // Sets the debounce interval - void interval(unsigned long interval_millis); - // Updates the pin - // Returns 1 if the state changed - // Returns 0 if the state did not change - int update(); - // Forces the pin to signal a change (through update()) in X milliseconds - // even if the state does not actually change - // Example: press and hold a button and have it repeat every X milliseconds - void rebounce(unsigned long interval); - // Returns the updated pin state - int read(); - // Sets the stored pin state - void write(int new_state); - // Returns the number of milliseconds the pin has been in the current state - unsigned long duration(); - // The risingEdge method is true for one scan after the de-bounced input goes from off-to-on. - bool risingEdge(); - // The fallingEdge method it true for one scan after the de-bounced input goes from on-to-off. - bool fallingEdge(); - -protected: - int debounce(); - unsigned long previous_millis, interval_millis, rebounce_millis; - uint8_t state; - uint8_t pin; - uint8_t stateChanged; -}; - -#endif - - diff --git a/Bounce1/documentation.txt b/Bounce1/documentation.txt deleted file mode 100644 index a54337f..0000000 --- a/Bounce1/documentation.txt +++ /dev/null @@ -1,13 +0,0 @@ -Bounce library for Arduino - -Version 1.5 - -by Thomas Ouellet Fredericks -with contributions from: -Eric Lowry -Jim Schimpf -Tom Harkaway - -contact: mrtoftrash@gmail.com - -See the online documentation here: http://www.arduino.cc/playground/Code/Bounce diff --git a/Bounce1/examples/bounce/bounce.pde b/Bounce1/examples/bounce/bounce.pde deleted file mode 100644 index d706884..0000000 --- a/Bounce1/examples/bounce/bounce.pde +++ /dev/null @@ -1,32 +0,0 @@ -#include - -// This code turns a led on/off through a debounced button -// Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button - -#define BUTTON 2 -#define LED 13 - -// Instantiate a Bounce object with a 5 millisecond debounce time -Bounce bouncer = Bounce( BUTTON,5 ); - -void setup() { - pinMode(BUTTON,INPUT); - pinMode(LED,OUTPUT); -} - -void loop() { - // Update the debouncer - bouncer.update ( ); - - // Get the update value - int value = bouncer.read(); - - // Turn on or off the LED - if ( value == HIGH) { - digitalWrite(LED, HIGH ); - } else { - digitalWrite(LED, LOW ); - } - -} - diff --git a/Bounce1/examples/change/change.pde b/Bounce1/examples/change/change.pde deleted file mode 100644 index 63074e0..0000000 --- a/Bounce1/examples/change/change.pde +++ /dev/null @@ -1,31 +0,0 @@ -#include -#define BUTTON 2 -#define LED 13 - -int ledValue = LOW; - -// This example changes the state of the LED everytime the button is pushed -// Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button - - -Bounce bouncer = Bounce( BUTTON, 5 ); - -void setup() { - pinMode(BUTTON,INPUT); - pinMode(LED,OUTPUT); -} - -void loop() { - - if ( bouncer.update() ) { - if ( bouncer.read() == HIGH) { - if ( ledValue == LOW ) { - ledValue = HIGH; - } else { - ledValue = LOW; - } - digitalWrite(LED,ledValue); - } - } -} - diff --git a/Bounce1/examples/duration/duration.pde b/Bounce1/examples/duration/duration.pde deleted file mode 100644 index 3a6faed..0000000 --- a/Bounce1/examples/duration/duration.pde +++ /dev/null @@ -1,59 +0,0 @@ -#include - -/* -This example uses a mercury tilt switch to detect the orientation -of a robot. If you turn the bot over, it falls asleep to conserve -battery life. If you have ever used a tilt switch before, -you know they can be very "noisy" - they jump around a lot! -The bounce library can handle sensing when a noisy switch has -"settled down" with the "duration" method that tells you how long -the pin has been in the current state. -*/ - -const uint8_t ORIENTATION_PIN = 16; - -Bounce orientation = Bounce( ORIENTATION_PIN, 50 ); - -int awake; // Are we awake based on our current orientation? - -void setup() { - - pinMode( ORIENTATION_PIN, INPUT ); - digitalWrite( ORIENTATION_PIN, HIGH ); // Activate Pull-Up - - Serial.begin(19200); - Serial.println( "Orientation Test " ); - Serial.println(); - - awake = orientation.read(); - - Serial.println( awake ? "Awake!" : "Asleep!" ); - -} - -unsigned long lastKnock = 0; - -void loop() { - - orientation.update(); - - // has our orientation changed for more the 1/2 a second? - if ( orientation.read() != awake && orientation.duration() > 500 ) { - - awake = orientation.read(); - - if ( awake ) { - - Serial.println( "Waking Up!" ); - // Do Something Here... - - } - else { - - Serial.println( "Falling Asleep" ); - // Do Something Here... - - } - } - -} diff --git a/Bounce1/examples/edge/edge.pde b/Bounce1/examples/edge/edge.pde deleted file mode 100644 index b38f29b..0000000 --- a/Bounce1/examples/edge/edge.pde +++ /dev/null @@ -1,121 +0,0 @@ - -// Edge Test For use with the DANGER SHIELD - -// This code turns a LED on and incraments number displayed on the 7-segment display -// whenever either PB1 or PB2 is pressed. PB1 used the debounce library and PB2 does -// not. PB1 will cleanly increment the displayed value. PB2 will not alway increment -// the display because the switch is not debounced. -// -// The bounce library also detects the rising or falling edge of the input. -// This is often called a one-shot and is usefull if you want something to only -// happen once when a button is pressed or released. The risingEdge method is true -// for only one scan when the input goes from off-to-on. The fallingEdge method is -// true for only one scan when the input goes from on-to-off. Even if you are not -// using the debounce feature the the library you need to call the update method -// every scan for the edge detection to work. -// -// Notes: -// The buttons on the Danger Shield pull the input to ground when they are pressed, -// so they act like normally closed switches. If order to make them work like one -// would expect, he tests for the button states are reversed. This also reversesd -// the rising edge test on button1 to a falling edge test. -// -// Since PB2 is not debounced, the edge detection is done directly in the sketch. -// - - -#include - -// This code turns a led on/off through a debounced button -// Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button - -#define BUTTON1 10 -#define BUTTON2 11 -#define BUTTON3 12 - -#define BUZZER 3 - -#define LED1 5 -#define LED2 6 - -#define LATCH 7 -#define CLOCK 8 -#define DATA 4 - - -// Shift register bit values to display 0-9 on the seven-segment display -const byte ledCharSet[16] = { - B00111111, B00000110, B01011011, B01001111, B01100110, - B01101101, B01111101, B00000111, B01111111, B01101111, - B01110111, // a - B01111100, // b - B00111001, // c - B01011110, // d - B01111001, // e - B01110001 // f -}; - -byte pressCount= 0; -bool lastButton2; - -// Instantiate a Bounce object with a 5 millisecond debounce time -Bounce bouncer1 = Bounce(BUTTON1, 5); - -void setup() { - pinMode(BUTTON1, INPUT); - pinMode(LED1, OUTPUT); - - pinMode(BUTTON2, INPUT); - pinMode(LED2, OUTPUT); - - pinMode(BUTTON3, INPUT); - pinMode(BUZZER, OUTPUT); - - pinMode(LATCH, OUTPUT); - pinMode(CLOCK, OUTPUT); - pinMode(DATA, OUTPUT); - - lastButton2 = digitalRead(BUTTON2); - - displayDigit(255, true); -} - - -void loop() { - - // Update debouncer - boolean button1Changed = bouncer1.update(); - - // Turn on or off the LED - if ( !bouncer1.read()) { - digitalWrite(LED1, HIGH); - } else { - digitalWrite(LED1, LOW); - } - - int buttonValue2 = digitalRead(BUTTON2); - if (buttonValue2 == LOW) { - digitalWrite(LED2, HIGH); - } else { - digitalWrite(LED2, LOW); - } - - if ( bouncer1.fallingEdge() || // rising edge of button 1 - (lastButton2 && !buttonValue2)) { // rising edge of button 2 - displayDigit(pressCount, false); - pressCount++; - if (pressCount > 15) { pressCount = 0; } - } - - lastButton2 = digitalRead(BUTTON2); - -} - -void displayDigit(byte value, boolean dp) { - byte shiftData = 0; - if (value <= 15) { shiftData = ledCharSet[value]; } - if (dp) { shiftData |= B10000000; } - digitalWrite(LATCH,LOW); - shiftOut(DATA, CLOCK, MSBFIRST, ~shiftData); - digitalWrite(LATCH,HIGH); -} diff --git a/Bounce1/examples/rebounce/rebounce.pde b/Bounce1/examples/rebounce/rebounce.pde deleted file mode 100644 index a312bdc..0000000 --- a/Bounce1/examples/rebounce/rebounce.pde +++ /dev/null @@ -1,48 +0,0 @@ -#include - -// As long as the button is held down, the LED will blink -// Build the circuit indicated here: http://arduino.cc/en/Tutorial/Button - -#define BUTTON 2 -#define LED 13 - -// A variable to store the current LED state -int ledState = LOW; - -// Instantiate a Bounce object with a 5 millisecond debounce time -Bounce bouncer = Bounce( BUTTON,5 ); - -void setup() { - pinMode(BUTTON,INPUT); - pinMode(LED,OUTPUT); -} - -void loop() { - - // Update and monitor a change of input - if ( bouncer.update() ) { - - // Get the state of the button - int value = bouncer.read(); - - // Toggle the LED if the button is held - if ( value == HIGH) { - // Make the button retrigger in 500 milliseconds - bouncer.rebounce(500); - if ( ledState == LOW ) { - ledState = HIGH; - } else { - ledState = LOW; - } - } else { - ledState = LOW; - } - - digitalWrite(LED, ledState ); - - } - - - -} - diff --git a/Bounce1/keywords.txt b/Bounce1/keywords.txt deleted file mode 100644 index 929d49d..0000000 --- a/Bounce1/keywords.txt +++ /dev/null @@ -1,30 +0,0 @@ -####################################### -# Syntax Coloring Map For Debounce -####################################### - -####################################### -# Datatypes (KEYWORD1) -####################################### - -Bounce KEYWORD1 - -####################################### -# Methods and Functions (KEYWORD2) -####################################### - -update KEYWORD2 -interval KEYWORD2 -read KEYWORD2 -write KEYWORD2 -rebounce KEYWORD2 -risingEdge KEYWORD2 -fallingEdge KEYWORD2 - -####################################### -# Instances (KEYWORD2) -####################################### - -####################################### -# Constants (LITERAL1) -####################################### - diff --git a/Bounce2/Bounce2.cpp b/Bounce2.cpp similarity index 100% rename from Bounce2/Bounce2.cpp rename to Bounce2.cpp diff --git a/Bounce2/Bounce2.h b/Bounce2.h similarity index 100% rename from Bounce2/Bounce2.h rename to Bounce2.h diff --git a/Bounce2/LICENSE b/Bounce2/LICENSE deleted file mode 100644 index f945b53..0000000 --- a/Bounce2/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2013 thomasfredericks - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Bounce2/README.md b/Bounce2/README.md deleted file mode 100644 index 318fcc6..0000000 --- a/Bounce2/README.md +++ /dev/null @@ -1,9 +0,0 @@ -DOCUMENTATION -===================== - -https://github.com/thomasfredericks/Bounce-Arduino-Wiring/wiki - -DOWNLOAD -===================== - -https://github.com/thomasfredericks/Bounce-Arduino-Wiring/archive/master.zip \ No newline at end of file diff --git a/Bounce2/examples/bounce/bounce.ino b/examples/bounce/bounce.ino similarity index 100% rename from Bounce2/examples/bounce/bounce.ino rename to examples/bounce/bounce.ino diff --git a/Bounce2/examples/change/change.ino b/examples/change/change.ino similarity index 100% rename from Bounce2/examples/change/change.ino rename to examples/change/change.ino diff --git a/Bounce2/examples/circuit-bounce-change-duration-retrigger.png b/examples/circuit-bounce-change-duration-retrigger.png similarity index 100% rename from Bounce2/examples/circuit-bounce-change-duration-retrigger.png rename to examples/circuit-bounce-change-duration-retrigger.png diff --git a/Bounce2/examples/duration/duration.ino b/examples/duration/duration.ino similarity index 100% rename from Bounce2/examples/duration/duration.ino rename to examples/duration/duration.ino diff --git a/Bounce2/examples/retrigger/retrigger.ino b/examples/retrigger/retrigger.ino similarity index 100% rename from Bounce2/examples/retrigger/retrigger.ino rename to examples/retrigger/retrigger.ino diff --git a/Bounce2/keywords.txt b/keywords.txt similarity index 100% rename from Bounce2/keywords.txt rename to keywords.txt