#DEFINE precompile by custom GUI

Hi,
I am a new user of arduino environment and I need to create a software for arduino that contain a lot of #define that must be enabled or disabled by final users needs.
I try to explain...
I wat to develop a GUI (Graphical User Interface) with final user must play and during first steps user must configure system giving information about what kind of sensors has installed on, whitch kind of robot had (tree-four- arms) and so on. So when option selecting was done it must send configuration on arduino. The GUI must active and disactive some defines so software must compile firmware and send it to arduino board.
I would to obtain this in the same control GUI used to control the system - it is written in processing.
Cound someone help me?

Defines are not left in the program once it has been compiled. The are referenced during the compilation process and the resulting code will be set to the selected values. If you want to change the values at runtime then you will need configuration values that you can change from the GUI and control the flow of the program with if statements.

I know what you tell, but I want not to do this at runtime but at compilation time. I want to use a gui not arduino ide. User must select options and this options will translates in //#define (disabled define) or #define (enable define) so underlevel compiler must compile and send firmware to arduino processor. This process is only performed by user at the setup time, first time, during commissioning system. So I want to implement this in main GUI so user must not manipulate firmware source code directly...

I know what you tell, but I want not to do this at runtime but at compilation time.

I don't think I understand this.

I want to use a gui not arduino ide.

To do what? If the objective of the GUI is to change the programming on the Arduino, it will need to invoke the compiler, the linker, and the uploader. The use of #define statements, or not, is up to you.

If the idea is to send some data to the Arduino, and have it change what it does, AT RUN TIME, then the use of #defines makes no sense, since the code on the Arduino has no #defines in it. They are stripped out before the compiler even starts, but the preprocessor.

My project had many #define that enable or disable specific feature. If I compile all program it will not fit in arduino. So user must define what kind of hardware have on system and then send firmware to arduino. I want not user to manipulate software so I want to do that by a gui and a graphical step-by-step selections. So user select hardware and all options and gui enable or disable that defines, preprocess, compile and send. It is possible using some kind of software to obtain that?

It is possible using some kind of software to obtain that?

Yes, though not necessarily easy. Your code would have to edit the sketch, to set the values of the #define statements, then invoke the compiler, the linker, and the uploader with the correct arguments, in the correct order.

Otherwise, compiler directives are useless at run time, as they are stripped out at compile time.

ok.
Have you some link or some example on how to obtain it?
Thanks

Have you some link or some example on how to obtain it?

That would all depend on what "it" is.

please... #define "it" .... :smiley:

PaulS:

It is possible using some kind of software to obtain that?

Yes, though not necessarily easy. Your code would have to edit the sketch, to set the values of the #define statements, then invoke the compiler, the linker, and the uploader with the correct arguments, in the correct order.

Otherwise, compiler directives are useless at run time, as they are stripped out at compile time.

Right.
I can write a code to manipulate all #define in on file so after I must call in sequence the compiler, the linker and the uploader... but how?

I can write a code to manipulate all #define in on file so after I must call in sequence the compiler, the linker and the uploader... but how?

Enable verbose mode in the IDE. Compile, link, and upload code. You will see all the commands, arguments, and output that the IDE uses/sets/produces.

Then, do the same things from your application.

PaulS --- MANY MANY THANKS!!!
You are a ARDUINO GURU!
I will try.
Many Thanks!