Dependencies:   mbed

Committer:
simon
Date:
Thu Nov 26 16:00:28 2009 +0000
Revision:
0:18acd94db10b

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
simon 0:18acd94db10b 1 // Example showing multiple files using the same mbed interface instances
simon 0:18acd94db10b 2 // sford
simon 0:18acd94db10b 3 //
simon 0:18acd94db10b 4 // * The interfaces we want are in interfaces.h/cpp (e.g. our digital outputs)
simon 0:18acd94db10b 5 // - they are instanced in the .cpp file so they exist
simon 0:18acd94db10b 6 // - they are listed in the .h file as extern, so others can use them
simon 0:18acd94db10b 7 // * Both main and otheruser include interfaces.h, so can both use it
simon 0:18acd94db10b 8
simon 0:18acd94db10b 9 #include "mbed.h"
simon 0:18acd94db10b 10 #include "interfaces.h"
simon 0:18acd94db10b 11 #include "otheruser.h"
simon 0:18acd94db10b 12
simon 0:18acd94db10b 13 int main() {
simon 0:18acd94db10b 14 while(1) {
simon 0:18acd94db10b 15 led1 = led3 = 0; // main uses led1, defined in interfaces
simon 0:18acd94db10b 16 led2 = led4 = 1;
simon 0:18acd94db10b 17 wait(0.2);
simon 0:18acd94db10b 18 otheruser(); // otheruser uses led1, defined in interfaces
simon 0:18acd94db10b 19 wait(0.2);
simon 0:18acd94db10b 20 }
simon 0:18acd94db10b 21 }