Strange error ?

Hello
I have made wemos d1 mini + ina219+ sd card.
Where you save the current and voltage on an sd card
with the following sketch.

#include <Wire.h>
#include <Adafruit_INA219.h>
#include <SD.h>
#include <SPI.h>

// Create an Adafruit_INA219 object
Adafruit_INA219 ina219;

// Define the SD card chip select pin
const int chipSelect = D8; // Change this to your actual CS pin

File dataFile;

void setup() {
  // Initialize serial communication
  Serial.begin(115200);
  
  // Initialize the INA219 sensor
  if (!ina219.begin()) {
    Serial.println("Failed to find INA219 sensor, check wiring!");
    while (1);
  }
  
  // Initialize the SD card
  if (!SD.begin(chipSelect)) {
    Serial.println("SD card initialization failed!");
    return;
  }
  
  // Create a new file on the SD card
  dataFile = SD.open("data.txt", FILE_WRITE);
  if (!dataFile) {
    Serial.println("Error opening data.txt");
  }
  
  // Print column headers to the file
  dataFile.println("Voltage (V)\tCurrent (mA)\tPower (mW)");
  dataFile.flush();
}

void loop() {
  // Read sensor data
  float busVoltage = ina219.getBusVoltage_V();
  float current_mA = ina219.getCurrent_mA();
  float power_mW = ina219.getPower_mW();
  
  // Print data to serial monitor
  Serial.print("Voltage: "); Serial.print(busVoltage); Serial.print(" V\t");
  Serial.print("Current: "); Serial.print(current_mA); Serial.print(" mA\t");
  Serial.print("Power: "); Serial.print(power_mW); Serial.println(" mW");
  
  // Write data to SD card
  dataFile.print(busVoltage);
  dataFile.print("\t");
  dataFile.print(current_mA);
  dataFile.print("\t");
  dataFile.print(power_mW);
  dataFile.println();
  dataFile.flush();
  
  // Delay for a while
  delay(1000); // Adjust the delay as needed
}

getting the strange error

C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp: In member function 'virtual fs::FileImplPtr sdfs::SDFSImpl::open(const char*, fs::OpenMode, fs::AccessMode)':
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:67:25: error: conversion from 'FsFile' to non-scalar type 'File32' requested
67 | File32 fd = _fs.open(path, flags);
| ^~~~~
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp: In member function 'virtual fs::DirImplPtr sdfs::SDFSImpl::openDir(const char*)':
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:97:41: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
97 | dirFile = _fs.open("/", O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:100:45: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
100 | dirFile = _fs.open(pathStr, O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:110:49: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
110 | dirFile = _fs.open("/", O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:115:53: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
115 | dirFile = _fs.open(pathStr, O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:125:45: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
125 | dirFile = _fs.open("/", O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'
C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:130:49: error: no match for 'operator=' (operand types are 'File32' and 'FsFile')
130 | dirFile = _fs.open(pathStr, O_RDONLY);
| ^
In file included from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatVolume.h:27,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatLib.h:28,
from c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/SdFat.h:32,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.h:35,
from C:\Users\Henrik\AppData\Local\Arduino15\packages\esp8266\hardware\esp8266\3.1.2\libraries\SDFS\src\SDFS.cpp:27:
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(const File32&)'
1023 | class File32 : public StreamFile<FatFile, uint32_t> {
| ^~~~~~
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'const File32&'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: candidate: 'constexpr File32& File32::operator=(File32&&)'
c:\Users\Henrik\Documents\Arduino\libraries\SdFat\src/FatLib/FatFile.h:1023:7: note: no known conversion for argument 1 from 'FsFile' to 'File32&&'

exit status 1

Compilation error: exit status 1

what should i do???

Just a WAG, but check to see if your SdFat library is up to date.

SdFat library?? I use the SD library and this is up to date.
The other libraries are also up to date
I don't know how to get the SdFat library into my sketch.??

Thanks

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.