trouble w/ DebounceIn

31 May 2013

I am trying to acquaint myself w/ Andy Kirkhams DebounceIn library and having a problem with the example code below...

 #include "mbed.h"
 #include "DebounceIn.h"
 
  DebounceIn  d(p5);
  DigitialOut led1(LED1);
  DigitialOut led2(LED2);
 
  int main() {
      while(1) {
          led1 = d;
          led2 = d.read();
      }
  }

When trying to compile Andy's example, I always receive the following error.. "no instance of constructor "mbed::DigitalIn::DigitalIn" matches the argument list" in file "DebounceInDebounceIn.h", Line: 95, Col: 135". Anyone have a clue as to what this means? Should be straight forward I would think but it's eluding me. Thanks..

31 May 2013

DebounceIn uses DigitalIn, and the DigitalIn constructor in DebounceIn is invalid in the newer mbed libraries.

Change in the DebounceIn code the following line:

DebounceIn(PinName pin, const char *name = NULL) : DigitalIn(pin, name) {...

to

DebounceIn(PinName pin, const char *name = NULL) : DigitalIn(pin) {...

And if you want you can also remove the const char *name = NULL part.

31 May 2013

Thanks Erik...

01 Jun 2013

FYI I decided to test the new pull request feature by modifying the library and sending a pull request to Andy Kirkham. He accepted it, so if you either re-import the library, or click on the library -> update in your program you should get a new version which has the change in it.