Arduino 没有用于调用的匹配函数

Arduino no matching function for call to

本文关键字:函数 调用 用于 Arduino      更新时间:2023-10-16

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

法典:

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)ArduinolibrariesSDsrc/SD.h:38:15: note: virtual int File::available()
   virtual int available();
               ^
C:Program Files (x86)ArduinolibrariesSDsrc/SD.h:38:15: note:   candidate expects 0 arguments, 1 provided
Error compiling.

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

谁能帮我?

它肯定看起来像

while (myFile.available(filename)) {

应改为

while (myFile.available()) {