Pages: [1]   Go Down
Author Topic: Functions in separate tab - Help?  (Read 354 times)
0 Members and 1 Guest are viewing this topic.
Ballston Spa, NY
Offline Offline
Jr. Member
**
Karma: 0
Posts: 60
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

Seattle, WA USA
Offline Offline
Brattain Member
*****
Karma: 614
Posts: 49372
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 73
Posts: 7197
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Pages: [1]   Go Up
Jump to: