Go Down

Topic: Functions in separate tab - Help? (Read 375 times) previous topic - next topic

drbogger

Hi All,

Okay, I have my sketch, but it's kinda large & messy.
I want to move all the functions to a separate tab or file.

Is there a certain way i have to do this? if so, how?

PaulS

You can add additional tabs. The extension for the file associated with a tab needs to be .c, .cpp, or .h.

A sketch can include a .h file, as can a .c or .cpp file. The .c or .cpp file with the same name as an included .h file will be compiled. After all the compilation is complete, all the .o files are accessed by the linker to create the final hex file.

You can put functions in a .c or .cpp file. Be aware that the pde file is converted to a cpp file before the compiler is called, and that the c++ compiler performs name mangling. This means that it is easier to call functions in a .cpp file than in a .c file.

liudr

http://liudr.wordpress.com/2011/02/16/using-tabs-in-arduino-ide/

Go Up