Arduino没有匹配函数来调用

时间:2014-12-03 20:02:43

标签: c++ file variables arduino arduino-uno

我为我的arduino uno创建了程序,但我无法编译它。 程序基于IRemote IRecord示例和SD示例。

CODE:

void sendCode(int repeat) {
   strcodeValue = String(codeValue);
   char filename[strcodeValue.length()+1];
   strcodeValue.toCharArray(filename, sizeof(filename));

   if (SD.exists(filename)) {   
   File myFile = SD.open(filename);
   if (myFile) {
    while (myFile.available(filename)) {
      codeValue = myFile.read();
    }
    myFile.close();
  }
   }
...
}

错误:

IRrecord.ino: In function 'void sendCode(int)':
IRrecord.ino:130:37: error: no matching function for call to 'File::available(char [(((sizetype)<anonymous>) + 1)])'
IRrecord.ino:130:37: note: candidate is:
In file included from IRrecord.ino:18:0:
C:\Program Files (x86)\Arduino\libraries\SD\src/SD.h:38:15: note: virtual int File::available()
   virtual int available();
               ^
C:\Program Files (x86)\Arduino\libraries\SD\src/SD.h:38:15: note:   candidate expects 0 arguments, 1 provided
Error compiling.

将从IR Sensor读取文件名。

任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:0)

肯定看起来像

while (myFile.available(filename)) {

应该阅读

while (myFile.available()) {