2014-12-03 211 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()) {