Simple IDE Question

Hi Everyone,
I have written alot of code and its getting a bit messy now.
What's the best way/is it possible to, include other sketches inside my main sketch. As i could do in C. the sketches are pde files, can i just #include them?
Or do I just creat some .h files??
For example,
My I/O routines and Calculations could very easily be broken down into other files. So could alot of the variable..

Thanks

Pete

While I haven't used it yet, there is a tab function in the Arduino IDE that allows you to have additional Arduino C code placed which will be automatically included and compiled with the main sketch (no include statements needed in your main skectch). Read a brief description at the botton on this linked page: http://www.arduino.cc/en/Guide/Environment

By the way your post should have been done in the software section of this forum for better classification on the question.

Lefty

Oops I didn't realise I was in the hardware section!
I'll double check next time!
Thanks for the reply!

Pete

Hi I've tried but i must be doing something wrong, if anyone can point me in the right direction i would be very greatful.
Right in my main pde i have

unsigned long time_diff;

void setup(){
Serial.begin(9600);
}
void loop(){
Serial.print("Time: ");
timer(); // calc time for loop
//prints timefor loop
Serial.print(time_diff);
Serial.println();

// wait a second
delay(1000);
}

and in a timer.pde i have the timer routine which is inserted into the IDE
void timer(){
unsigned long time;
unsigned long time1 = 0;
time1 = time;
time = millis();
time_diff = time - time1;
}

The complier is coming back with the error
In function 'void timer()':
error: redefinition of 'void timer()' In function 'void timer()':

I dont see what i have done wrong!
Thanks again for your help!

Pete

Just tried compiling this on Arduino 17 on a PC running XP and it compiles without errors.

I had this exact same error last night in 017

save all your work and restart the ide, it should go away

What i noticed is for whatever reason it had 2 copys of the same tab in the tabs dropdown list

if it helps anyone, it was after i made a new tab (so 2 tabs and the main pde open) and then deleted the new tab

I don't believe it! I spent a good hour trying to get that to work!
Osgeld, you have saved me from going mad!

Thanks it all works now!

Pete