IWEUA.COM
Arduino Compile Error 1
Using Tabs & #include
I use Arduino Tabs regularly to keep code organised and clean, even on small sketches they can be handy.

i personally only use two types, Tabs which have an extension .ino and .h eg :  FileNameSomething.ino and
FilenameSomethingElse.h

The Tabs with an ino extension are great for putting working tested functions into that you just want to forget
about and not clutter up the main page ( which is where I put all my new 'under test ' functions in )

The other extension type is the Tab.h type which is where all my Sketch setup information is placed including all
my global variables, #define statements and any compile time instructions, #ifdef / #endif


My sketch last night which would not compile was as follows

Main Sketch                                                tab1.h
#include "tab1.h                                          byte TestVariable = B00000000;                                                      

void setup()                                                                                                             
{ Serial.begin(9600);}

void loop{ Function1() }

void Function1()
{ Serial.println(TestVariable); }

Brings compile error : 'TestVariable' was not declared in this scope

To quickly fix the error move byte TestVariable = B00000000; into the Main Sketch and place on the top line, but
that isn't really satisfactory as it does render the tab1.h file redundant!

The proper fix, at the top of the Main Sketch ( or tab1.h ) is to force the inclusion of the library Arduino.h : thus
just add " #include <Arduino.h> "  to either the main sketch or  tab1.h ( neater ) which will look like this

tab1.h
#include <Arduino.h>
byte TestVariable = B00000000;


Now this fault is slightly odd and you are unlikely ever to come across it as most of your sketches will include
some libraries, Wire.h, Ethernet.h SPI.h etc and by adding any of these libraries to the top of your main sketch
the fault will disappear.

Why does this fault occur ? It is all to do with the order of the compile. There are better references and experts
to the fault so I will step out now and just forward you to the link by Liudr to whom I owe my thanks :

Using tabs in Arduino IDE