Pages: [1]   Go Down
Author Topic: Bounce tutorial  (Read 3040 times)
0 Members and 1 Guest are viewing this topic.
Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm trying to use the code below but when I try to verify it, it says 'Bounce' does not name a type with Bounce bouncer = Bounce( BUTTON, 5 ); highlighted

#include <Bounce.h>
#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);
     }
   }
}
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 302
Posts: 26250
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have you installed the Bounce library correctly?
Logged

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Good question.. in the arduino playground it says "Put the Bounce folder in "your Arduino Sketch Folder/libraries/"." I'm not really sure where that is.. I'm using a mac and I can't find my Arduino Sketch Folder?? Any idea how I can do it... Thanks for your help smiley
Logged

Sydney, Australia
Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Figured it out!! smiley thanks anyway AWOL!
Logged

Pages: [1]   Go Up
Jump to: