2014-12-03 179 views
0

我已经为我的arduino uno创建了程序,但是我无法编译它。 基于IRemote IRecord示例的程序和SD示例。Arduino没有匹配函数调用

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. 

文件名会从红外传感器读取。

任何人都可以帮助我吗?

回答

0

它肯定看起来像

while (myFile.available(filename)) { 

应该读

while (myFile.available()) {