How am I supposed to use the tabs?
i've made light use of tabs in ide in few programs i've written, current program more complex , thought seperate out various functions various tabs keep track of everyting. ie, tab sound code , globals, tab servo code , globals, etc.
but when tried doing ran nothing problems.
for example, apparently global variable declared in 1 tab isn't global @ , local functions in tab? to around this, gave in , moved globals main tab. but ran error function in 1 tab referenced functions in tab , complained out of scope.
so i'm wondering should do. i mean seems way solve declare functions somewhere. but rubs me wrong way. take servo functions example. i want seperate set of functions can include in future projects. but seems here choices limited redeclaring functions in in main program, or creating header file declarations , including @ top of code. the latter not nice solution because i'll have twice many tabs in ide , half of them have 1 or 2 lines of code.
i guess rename tabs header files, , stick functions , globals functions in there think need careful order include files or else function might use global declared after in include list, , i'm guessing lead error variable not being declared...
i want clean way of doing this. i'm used working ide in language kept functions listed me on side of pane jump between them, didn't matter if stuff in 1 file, code mess , it's hard jump need to @ stuff , go back.
anyway, suggestions how should handle cleaning code in way works ide appreciated.
but when tried doing ran nothing problems.
for example, apparently global variable declared in 1 tab isn't global @ , local functions in tab? to around this, gave in , moved globals main tab. but ran error function in 1 tab referenced functions in tab , complained out of scope.
so i'm wondering should do. i mean seems way solve declare functions somewhere. but rubs me wrong way. take servo functions example. i want seperate set of functions can include in future projects. but seems here choices limited redeclaring functions in in main program, or creating header file declarations , including @ top of code. the latter not nice solution because i'll have twice many tabs in ide , half of them have 1 or 2 lines of code.
i guess rename tabs header files, , stick functions , globals functions in there think need careful order include files or else function might use global declared after in include list, , i'm guessing lead error variable not being declared...
i want clean way of doing this. i'm used working ide in language kept functions listed me on side of pane jump between them, didn't matter if stuff in 1 file, code mess , it's hard jump need to @ stuff , go back.
anyway, suggestions how should handle cleaning code in way works ide appreciated.
quote
so i'm wondering should do.
global scope refers file defined in. can use extern keyword in file (on tab) declare variable same name, refer global declared in first file:
global.pde
code: [select]
const int ledpin = 12; // define pin led attachedlights.pde
code: [select]
extern const int ledpin; // refers pin defined in global.pdeit's not clear issue functions is. tried this:
twotabs.pde
code: [select]
const int ledpin = 13;
void setup()
{
serial.begin(9600);
}
void loop()
{
lights();
}lights.pde
code: [select]
extern const int ledpin;
void lights()
{
digitalwrite(ledpin, high);
delay(200);
digitalwrite(ledpin, low);
delay(200);
}this compiles, links, uploads, , makes led blink.
so, naming other tabs?
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > How am I supposed to use the tabs?
arduino
Comments
Post a Comment