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