Closed dannybox347 closed 10 years ago
There is no matching constructor that takes a boolean and integer. The code you are using is wrong.
This issue tracker is intended for bugs in the Arduino environment itself, not for getting help with your own (or other peoples) code. Better places to get support for this is http://forum.arduino.cc, or contacting the author of the library / code you are using. Don't forget to include the actual compiler errors there - just saying "there are errors" isn't very helpful.
Could you close this issue?
Where exactly did you get this buggy example code?
You wrote "I download the Metro library from Github.com" and "the IRrecvRobot sample which includes the Metro.h command". Where, EXACTLY, did you get this stuff?
Matthijskooijman I went to the arduino support website and I was sent here to post it since I thought it could be a problem with the arduino library itself. Now, the errors are included here, just scroll by the middle of the page and you will see it, but I'll repaste it for you: Then the error is this:
Arduino: 1.5.7 (Windows 7), Board: "Arduino Leonardo"
sketch_jul27a.ino:38:29: error: no matching function for call to 'Metro::Metro(int, bool)' sketch_jul27a.ino:38:29: note: candidates are: In file included from sketch_jul27a.ino:24:0: C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: Metro::Metro(long unsigned int) Metro(unsigned long interval_millis); ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: candidate expects 1 argument, 2 provided C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: Metro::Metro() Metro(); ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: candidate expects 0 arguments, 2 provided C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: Metro::Metro(const Metro&) class Metro ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: candidate expects 1 argument, 2 provided
PaulStoffregen
I got the link from the arduino website (suggested by Arduino): http://playground.arduino.cc/Code/Metro
and here I used the link: https://github.com/thomasfredericks/Metro-Arduino-Wiring
I downloaded it and installed it in the library. Then I download 5 sample from DFRobot at this link: http://www.dfrobot.com/index.php?route=product/product&product_id=570#.U8WOKJRdWSp
Metro.h command worked fine in two out of the 3 samples, that means it was installed correclty. The other 3 was including bluetooth or IR remote (which is one of the one I posted) and I was giving the same error. I also installed the IR remote library and is working fine.
Thanks to Dan Nixon I figured it could me DFrobot code issue and I contacted them... waiting for an answer to see if it is their issue or not.
Maybe this helps best Then the error is this:Arduino: 1.5.7 (Windows 7), Board: "Arduino Leonardo"sketch_jul27a.ino:38:29: error: no matching function for call to 'Metro::Metro(int, bool)'sketch_jul27a.ino:38:29: note: candidates are:In file included from sketch_jul27a.ino:24:0:C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: Metro::Metro(long unsigned int)Metro(unsigned long intervalmillis);^C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: candidate expects 1 argument, 2 providedC:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: Metro::Metro()Metro();^C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: candidate expects 0 arguments, 2 providedC:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: Metro::Metro(const Metro&)class Metro^C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: candidate expects 1 argument, 2 providedThe Metro.h has this:+1.+2./+3. * This program is free software; you can redistribute it and/or modify+4. * it under the terms of the GNU General Public License as published by+5. * the Free Software Foundation; either version 2 of the License, or+6. * (at your option) any later version.+7. +8. * This program is distributed in the hope that it will be useful,+9. * but WITHOUT ANY WARRANTY; without even the implied warranty of+10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+11. * GNU General Public License for more details.+12. +13. * You should have received a copy of the GNU General Public License+14. * along with this program; if not, write to the Free Software+15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,+16. * MA 02110-1301, USA.+17. /+18.+19.+20.+21./ * * * * * * * * * * * * * * * * * * * * * * * * * * * +22. Main code by Thomas O Fredericks (tof@t-o-f.info)+23. Contributions by Paul Bouchier and Benjamin.soelberg+24._ * * * * * * * * * * * * * * * * * * * * * * * * * * * */+25.+26.#ifndef Metro_h+27.#define Metro_h+28.+29.#include "inttypes.h> // AVOIDED "<" SO YOU CAN SEE IT+30.+31.+32.class Metro+33.{+34.+35. public:+36. Metro();+37. Metro(unsigned long interval_millis);+38. void interval(unsigned long interval_millis);+39. uint8_t check();+40. void reset();+41.+42.private:+43. unsigned long previous_millis, interval_millis;+44.+45.};+46.+47.#endif+48.
Date: Tue, 29 Jul 2014 05:56:08 -0700 From: notifications@github.com To: Arduino@noreply.github.com CC: dannybox347@hotmail.com Subject: Re: [Arduino] Metro.h files has errors? (#2212)
Where exactly did you get this buggy example code?
You wrote "I download the Metro library from Github.com" and "the IRrecvRobot sample which includes the Metro.h command". Where, EXACTLY, did you get this stuff?
— Reply to this email directly or view it on GitHub.
You're using DF Robot's samples, which depend on copy of Metro which DF Robot modified, with the original (not modified) Metro library.
Delete the copy of Metro you got from the Arduino Playground page and use DF Robot's copy, which has the modifications which are needed for DF Robot's samples.
On July 30, 2014 at 1:45 AM Paul Stoffregen notifications@github.com wrote:
You're using DF Robot's samples, which depend on copy of Metro which DF Robot modified, with the original (not modified) Metro library.
Delete the copy of Metro you got from the Arduino Playground page and use DF Robot's copy, which has the modifications which are needed for DF Robot's samples.
It's still a bug. DF Robot should have derived a class from Metro.h instead of messing with it directly.
peabo
I download the Metro library from Github.com and added it in the library. Im trying to run the "IRrecvRobot" sample which includes the Metro.h command and when compiling in Arduino it gives me a few errors suggesting the error is in the Metro.h file.
IRrecvRobot File
include "Metro.h> // AVOIDED "<" SO YOU CAN SEE IT
include "IRremote.h> // AVOIDED "<" SO YOU CAN SEE IT
Then the error is this:
Arduino: 1.5.7 (Windows 7), Board: "Arduino Leonardo"
sketch_jul27a.ino:38:29: error: no matching function for call to 'Metro::Metro(int, bool)' sketch_jul27a.ino:38:29: note: candidates are: In file included from sketch_jul27a.ino:24:0: C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: Metro::Metro(long unsigned int) Metro(unsigned long interval_millis); ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:37:3: note: candidate expects 1 argument, 2 provided C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: Metro::Metro() Metro(); ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:36:3: note: candidate expects 0 arguments, 2 provided C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: Metro::Metro(const Metro&) class Metro ^ C:\Program Files (x86)\Arduino\libraries\Metro/Metro.h:32:7: note: candidate expects 1 argument, 2 provided
The Metro.h has this:
+1. +2./ +3. * This program is free software; you can redistribute it and/or modify +4. * it under the terms of the GNU General Public License as published by +5. * the Free Software Foundation; either version 2 of the License, or +6. * (at your option) any later version. +7. *
+8. * This program is distributed in the hope that it will be useful, +9. * but WITHOUT ANY WARRANTY; without even the implied warranty of +10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +11. * GNU General Public License for more details. +12. *
+13. * You should have received a copy of the GNU General Public License +14. * along with this program; if not, write to the Free Software +15. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, +16. * MA 02110-1301, USA. +17. / +18. +19. +20. +21./ * * * * * * * * * * * * * * * * * * * * * * * * * * * +22. Main code by Thomas O Fredericks (tof@t-o-f.info) +23. Contributions by Paul Bouchier and Benjamin.soelberg +24.* * * * * * * * * * * * * * * * * * * * * * * * * * * * / +25. +26.#ifndef Metro_h +27.#define Metro_h +28. +29.#include "inttypes.h> // AVOIDED "<" SO YOU CAN SEE IT +30. +31. +32.class Metro +33.{ +34. +35. public: +36. Metro(); +37. Metro(unsigned long interval_millis); +38. void interval(unsigned long interval_millis); +39. uint8_t check(); +40. void reset(); +41.
+42.private: +43. unsigned long previous_millis, interval_millis; +44. +45.}; +46. +47.#endif +48.
I haven't modified any file and can't find why is not working (compiling). What seems to be the problem? github.com may have a problem on their Metro code or something. Or is it that the program Im running ( source: http://www.dfrobot.com/image/data/Dump/COMB0004manual_V05.pdf) is wrong!!!
\ I noticed that when I compile other files including for example Metro AlarmLightInterval=Metro(40); it does not return any error but those with two data in parentheses like Metro output = Metro(30,true); then the error shows up... please help