Include variables file

Hello, I am beginner, and don`t understand how do it easy;

I try to remote by IR all my TVs and else in my home...

So I have list like:
Philips Power 0xC
Philips Volume+ 0x10
JVC Power 0xC0E8
... and more

In future I want add a new devices IRs..

And I have function like IRSend(long code)

I don`t want to save list of IR in project ino file, try to save it near and inlude, but I have - "was not declared in this scope" in main file project

Make library is difficult for me...

Help us to help you...

What you mean ?

I mean, you can see your code, how it is structured, how the files are arranged, and what errors you get.
Sadly, we cannot.

I don`t have code yet!


#include <vars.h>

//long Test = 0xB;

void setup() {
  if(Test == 0xC) Test = 0xD; // Error: error: 'Test' was not declared in this scope

void loop() {


long Test = 0xC;

I don`t have code yet!

but I have - "was not declared in this scope" in main file project

You don't have code, yet it gives compilation errors?

#include "vars.h"

Yes, I find it too )))

Working OK!

And if it`s not difficult for you - what different between " and <> ?

what different between " and <> ?

Where the preprocessor looks for files.

#include "foo.h" says look for the file “foo.h” in the local directory, i.e. the directory containing the file that has the #include.
The < > form says look for the file in a pathname specified by compiler option or environment variable.

Great thanks!


long Test = 0xC;

That will work OK as long as only one C++/INO file needs to access the data, but is not good practice. It would be better to separate out the declaration and the definition into separate files, so that you have a .h file (which can be included anywhere that needs visibility of the variables) which declares them, and a .cpp file that defines them.


extern long Test;


long Test = 0xC;