Simon Ford
/
GlobalPinAssignments
Diff: main.cpp
- Revision:
- 0:18acd94db10b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Thu Nov 26 16:00:28 2009 +0000 @@ -0,0 +1,21 @@ +// Example showing multiple files using the same mbed interface instances +// sford +// +// * The interfaces we want are in interfaces.h/cpp (e.g. our digital outputs) +// - they are instanced in the .cpp file so they exist +// - they are listed in the .h file as extern, so others can use them +// * Both main and otheruser include interfaces.h, so can both use it + +#include "mbed.h" +#include "interfaces.h" +#include "otheruser.h" + +int main() { + while(1) { + led1 = led3 = 0; // main uses led1, defined in interfaces + led2 = led4 = 1; + wait(0.2); + otheruser(); // otheruser uses led1, defined in interfaces + wait(0.2); + } +}