1

I want to include a function in my sketch I moved to a .h file.

I did it as follows:

My code:

#include "header.h"

void setup() { fct(); }

void loop() {

}

My header:

#include "Arduino.h"
#ifndef MYHELPERS_H
#define MYHELPERS_H

void fct() { // stuff }

#endif

The same process seems to work for variables but the IDE says this function in not declared in this scope...

I don't understand what I'm doing wrong...

Thanks guys!

Spyro 999
  • 17
  • 5

1 Answers1

-1

I found a solution somewhere else on internet...

This portion:

#ifndef MYHELPERS_H
#define MYHELPERS_H

Was not written correctly... "MYHELPERS_H" should've been replaced by the name of my file. Now it works just fine.

Spyro 999
  • 17
  • 5