Setup() and loop() in other files

I have a project with files:

  • SDManager.cpp with SDManager class
  • main.cpp

I need to do something in SDManager.cpp that require loop() function to work so, how can access it?
I was thinking about just making SDManager loop function and calling it from main file loop but I don’t know is it a good way?

Hi !

Maybe you can call a second loop function located in SDManager.cpp ?
Like this:


SDManager manager;
void setup()
manager = new SDManager();
void loop()


void SDManager::loop()
// Do something each time loop function is called

1 Like

Hello, thanks for the answers, I was thinking about this method in post

but I don’t really know it is a good method