03-20-2015, 07:31 PM
Ed,
Short answer ... Under the Build Process headline here ... http://www.arduino.cc/en/Hacking/BuildProcess ... it says:
... which seems to suggest that if the .h file is in the sketch's directory it should find it.
The slightly longer answer ... I use Eclipse C++ with and Arduino plugin [C++] rather than the Arduino IDE [IDE].
Some of the differences are:
The .cpp file [C++] is called .ino [IDE], but I am guessing you simply copied the code into a new [IDE] project so you automatically got the .ino file.
The [IDE] does some things 'automatically' so it is 'easier' to use. In doing so it hides some stuff that a normal C developer [which I am not] would normally need to do.
What you might want to do is forget about the .h file. The [IDE] will silently add the ...
... line to your .ino file ... i.e. you will never see it but when the project is built "it is there". That takes care of part of what is in the .h file. The other line that is important ...
... you can put at the very top of your .ino file and remove these lines ...
... as they are only required when using the "less automatic" [C++] system that I am using.
Other than the include differences the two development environments should be compatible so we can share all of the code below the #include directives. Certainly not a big issue.
Arvid
Short answer ... Under the Build Process headline here ... http://www.arduino.cc/en/Hacking/BuildProcess ... it says:
Quote:The include path includes the sketch's directory, the target directory (<ARDUINO>/hardware/core/<CORE>/) and the avr include directory (<ARDUINO>/hardware/tools/avr/avr/include/), as well as any library directories (in <ARDUINO>/hardware/libraries/) which contain a header file which is included by the main sketch file.
... which seems to suggest that if the .h file is in the sketch's directory it should find it.
The slightly longer answer ... I use Eclipse C++ with and Arduino plugin [C++] rather than the Arduino IDE [IDE].
Some of the differences are:
The .cpp file [C++] is called .ino [IDE], but I am guessing you simply copied the code into a new [IDE] project so you automatically got the .ino file.
The [IDE] does some things 'automatically' so it is 'easier' to use. In doing so it hides some stuff that a normal C developer [which I am not] would normally need to do.
What you might want to do is forget about the .h file. The [IDE] will silently add the ...
Code:
#include "Arduino.h"
... line to your .ino file ... i.e. you will never see it but when the project is built "it is there". That takes care of part of what is in the .h file. The other line that is important ...
Code:
#include <util/atomic.h>
... you can put at the very top of your .ino file and remove these lines ...
Code:
// Do not remove the include below
#include "scaleReader.h"
... as they are only required when using the "less automatic" [C++] system that I am using.
Other than the include differences the two development environments should be compatible so we can share all of the code below the #include directives. Certainly not a big issue.
Arvid