Example of an "extern" declaration to reuse a global variable defined in one file in another file.
Dependencies: mbed
main.cpp@0:bc708d703171, 2015-09-23 (annotated)
- Committer:
- bjo3rn
- Date:
- Wed Sep 23 20:45:28 2015 +0000
- Revision:
- 0:bc708d703171
initial commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
bjo3rn | 0:bc708d703171 | 1 | #include "mbed.h" |
bjo3rn | 0:bc708d703171 | 2 | #include "myWait.h" |
bjo3rn | 0:bc708d703171 | 3 | DigitalOut redLed(LED_RED); |
bjo3rn | 0:bc708d703171 | 4 | DigitalOut greenLed(LED_GREEN); |
bjo3rn | 0:bc708d703171 | 5 | |
bjo3rn | 0:bc708d703171 | 6 | int main() { |
bjo3rn | 0:bc708d703171 | 7 | while(1) { |
bjo3rn | 0:bc708d703171 | 8 | redLed = 1; |
bjo3rn | 0:bc708d703171 | 9 | myWait(0.2); |
bjo3rn | 0:bc708d703171 | 10 | redLed = 0; |
bjo3rn | 0:bc708d703171 | 11 | myWait(0.2); |
bjo3rn | 0:bc708d703171 | 12 | } |
bjo3rn | 0:bc708d703171 | 13 | } |