SDCardLogHandlerRK Compile Error

Hello,

I am trying integrate the SDCardLogHandlerRK Simple example into an existing project using Visual Studio Code, and Particle Bsom OS 5.0.1

I am getting the following compiler error:

[{
“resource”: "/c:/Users//Documents/“DataLogger”,
“owner”: “cpptools”,
“severity”: 8,
“message”: “no matching function for call to ‘SdCardLogHandler<2048>::SdCardLogHandler(SdFat&, const int&, long unsigned int, LogLevel)’”,
“source”: “gcc”,
“startLineNumber”: 27,
“startColumn”: 85,
“endLineNumber”: 27,
“endColumn”: 85
}]

Here is the start of my .ino file

#include "Particle.h"
#include "SdCardLogHandlerRK.h"
#include "SdFat.h"
#include <Wire.h>
#include <Arduino.h>
#include "MCP23008-RK.h"
#include <SparkFun_u-blox_GNSS_Arduino_Library.h>
#include <SparkFun_BNO080_Arduino_Library.h>
#include "spark_wiring_stream.h"

SYSTEM_THREAD(ENABLED);

const int SD_CHIP_SELECT = A6;

SdFat sd;

SdCardLogHandler<2048> logHandler(sd, SD_CHIP_SELECT, SPI_FULL_SPEED, LOG_LEVEL_INFO); 

I am also calling loHandler.setup() in the setup section, and logHandler.loop() in the loop section.

I have tried running clean, and restarting Visual Studio Code as well as my desktop and still getting the same error.

It should work if you use an explicit setting instead of SPI_FULL_SPEED:

SPISettings spiSettings(8 * MHZ, MSBFIRST, SPI_MODE0);
SdCardLogHandler<2048> logHandler(sd, SD_CHIP_SELECT, spiSettings, LOG_LEVEL_INFO); 

Awesome I made that update ty, and now im getting:fatal error: SdFat.h: No such file or directory.

I tried including the SD Card Library from here after getting this error, but it added all kinds of other errors

What SdFat.h library/version are you using for this?

How did you add the library? Using Particle: Install Library from the command palette to install SdCardLogHandlerRK should automatically install SdFat.

However, if you are building locally in Workbench, not cloud compile, it’s probably because the library was not downloaded. Use Particle: Launch CLI and:

particle library copy SdFat

Make sure you remove any file you manually added.

Yes that fixed it! I was not aware of using the install feature from the command palette. It’s working great now.

1 Like

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