same directory as the sketch code.
I suspect ti is finding the header file because it is NOT complaining about not finding it
or maybe not ...
I put a line of code in the header file that I know is not "correct" and it had no complaints.
const char Bogus[3]="This string is too long";
I also tried renaming the file to ChipNames.ino (at least taht lets the IDE editor open the file).
No joy. 'ChipName' was not declared in this scope
That brings me to yet another stupid question:
Does the Arduino IDE support compiling sketches with multiple modules (w/o creating a library)?
Like using one file to hold the various functions and another for the main program loop?
or
Does it require a single monolithic file for a sketch?
• Start the Arduino IDE
• Click File / New
• Click File / Save
• Enter Topic_182900 for the file name then click OK
• Copy-and-paste the following into the "main" tab (the only change from the original post are the quotes)...
• Click the "down triangle" on the right-top
• Click New Tab
• Enter ChipNames.h for the file name then click OK
• Copy-and-paste the following into the ChipNames.h tab...
Well I found the problem.
If I place the "ChipNames.h" file in the directory
"C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino"
and everything works according plan ... but that points out a couple of weaknesses to the IDE: 1) It should have generated an error when it could not find the required header file to begin with. 2) The location I placed the file is a "protected directory" because the Arduino IDE is automatically installed in C:\Program Files (x86). I have to fight the OS to change anything there or to add or remove files. Possibly I am missing something about an alternate location that the IDE looks for files???? There is nothing listed in preferences.txt. sketchbook.path=C:\Users\firstname.lastname.KEYWILD\Documents\Arduino There is a directory there call libraries. I tried putting the file there as well. I even created a empty Chipnames.cpp to go with it. No joy. The only places that I can get it work are: C:\Program Files (x86)\Arduino\hardware\tools\avr\avr\include C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino (or one of the subdirectories with the appropriate sub added to the include statement)
This is NOT good. Surely there is a better solution.
lewtwo:
I place the "ChipNames.h" file in the directory
"C:\Program Files (x86)\Arduino\hardware\arduino\cores\arduino"
That's the wrong place for it.
Coding Badly has explained in excruciating detail exactly what he did, which worked. Have you followed those instructions exactly and had the same results?
Coding Badly wrote his message at the same time I wrote mine.
Both he and you are correct regarding the proper method and I did try to go back and edit my message. Unfortunately at the time the only thing coming from http://forum.arduino.cc/ was "guru meditation required" (Coomodore Amiga ?). :0
As it happens that allowed me time to follow up on his advice and do some further research.
"C" syntax convention:
use for system supplied files/libraries
use "delimiters" for user supplied files/libraries
When the arduino IDE opens a ".INO" file in a matching directory name (ie foo.ino in the directory foo) it will also open any files with the extensions ".c", ".ino", ".cpp" or ".h"
It ignores any files in the directory that have spaces in the file name regardless of the extension.
When processing the files the Arduino IDE concatenates the files together to pass to the gcc compiler by placing the header (.h) files first, the main .ino (foo.ino) file second and the rest in alphabetical order.
In order to share a header file or library between multiple sketches they should be placed in the directory
\libraries<your library name>
There must be a header file (.h) in the directory.
Example:
\libraries\foobar\foobar.h
From the top menu select: Sketch, Import Library. 'foobar' will be listed under "contributed".
This will add the line #include <foobar.h> to the top of the sketch.
Other header files may be added by selecting from the top menu: Sketch, Add file and browsing to the appropriate directory. I have NOT discovered where the Arduino IDE stores the reference to these additional files but it does keep them in the project.
Many thanks to Coding Badly for putting me on the correct path.