Here’s a stupid question. I want to keep my calibration data and servo center points in one file, and the actual variables and codes in another. How do I link the files?
config.bas
main.bas
“main.bas” references many constants that are contained in “config.bas”
I tried using the “C” syntax of:
#include “config.bas”
within my “main.bas” but it keeps pointing to a directory which is one level below where both config.bas and main.bas resides in. Both config.bas and main.bas are on the same level, and is included within the same project file “TCIK.prj.”
I noticed that Xan’s code has no syntax that points to any of his config files, but when I compile his code, it has no problem of references constants that are contained in other files…
I’m not an expert, but I think you have to create a project. Creating a project makes a single project file. Then you add files to it from the project menu. Never done it, but I listen to Nathan talk about it all the time.
Yep, you create a basic project and add/create the files. The files have to be contained within the same directory as the project file. The order the files are defined in your project is the order in which they are read.
I believe that there is a #include statement that also allows you include sources. Like: #include “lcd.basâ€
I suggest the #include always use a full path if the file is not in the same directory. You can try using “…/” syntax but there may be problems with that.
Also the files in projects can be moved around by dragging them up and down to chaneg the order in which they will be included during compiling.
Orde is important, but once you’ve got the files in the project oyu can drag them up and down in the project file list to change there order. You don’t have to remove them and re-add them. The order they show in the project file list is the order they are compiled. Since Basic doesn’t have a MAIN function that is called first, the first code in the first file is run first. Also since variables and constants have to be defined before used they have to be before code that uses them(even when in seperate files). Only Labels can be used before being defined.