Example of an "extern" declaration to reuse a global variable defined in one file in another file.
Dependencies: mbed
myWait.cpp
- Committer:
- bjo3rn
- Date:
- 2015-09-23
- Revision:
- 0:bc708d703171
File content as of revision 0:bc708d703171:
#include "mbed.h"
#include "myWait.h"
// extern declares that the global variable greenLed is defined in a different source file
extern DigitalOut greenLed;
// definition of our custom wait function
void myWait(float t) {
greenLed=0; //turn on
wait(t); //wait
greenLed=1; //turn off
}