Go Down

Topic: Tabs & Function() (Read 1 time) previous topic - next topic


I have broken up my code into four Tabs. Each section of code works interdependently, but I can't seem to reference sections of codes with in other Tabs (i.e GOSUB routines in simple speak).

void Setup and void Loop can only be used once, so I have used alternatives like void LCDsetup1() and void LCDloop2() in other Tabs. Is this the correct way to call up a particular function with in the main function?  
Any sample code that uses Tabs that I could review? :-[

Coding Badly

You will need to declare the shared functions.  Typically, this is done with header files but they are not required.

Let's say you have a function in one of your tabs...

void LCDsetup( void )
 // Prepare the LCD display

That you want to call from setup in your Sketch.  Your Sketch might look something like this...

Code: [Select]
void LCDsetup( void );

void setup( void )
 // Call LCDsetup in the other tab

void loop( void )

Does that help?


Thanks for the reply.

Do I need to include th relevant "include" statements a "int" declarations in the appropriate TAB, or can they be included in one main TAB?

i.e. if I have two TABS - (TAB A and TAB B), can I declare all of the int declarations in TAB A, even though though TAB B has the appropriate code  :-[instructions?

That may not make sense....but


Best thing to do is experiment...


Go Up

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131