![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Embedded software Assessment 2
Dependencies: MCP23017 SDFileSystem USBDevice WattBob_TextLCD mbed
main.cpp@2:8efdefa03347, 2014-02-15 (annotated)
- Committer:
- muaiyd
- Date:
- Sat Feb 15 17:28:23 2014 +0000
- Revision:
- 2:8efdefa03347
- Parent:
- 1:9a3cfeca7ecd
using Ticker
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
muaiyd | 0:86bba6bf9b6f | 1 | #include "Function.h" |
muaiyd | 2:8efdefa03347 | 2 | |
muaiyd | 2:8efdefa03347 | 3 | Ticker timer; |
muaiyd | 2:8efdefa03347 | 4 | DigitalOut led1(LED1); |
muaiyd | 2:8efdefa03347 | 5 | DigitalOut led2(LED2); |
muaiyd | 2:8efdefa03347 | 6 | |
muaiyd | 2:8efdefa03347 | 7 | int flip = 0; |
muaiyd | 2:8efdefa03347 | 8 | |
muaiyd | 2:8efdefa03347 | 9 | void attime() { |
muaiyd | 2:8efdefa03347 | 10 | flip = !flip; |
muaiyd | 2:8efdefa03347 | 11 | } |
muaiyd | 0:86bba6bf9b6f | 12 | |
muaiyd | 2:8efdefa03347 | 13 | int main() { |
muaiyd | 2:8efdefa03347 | 14 | timer.attach(&attime, 3); |
muaiyd | 2:8efdefa03347 | 15 | while(1) { |
muaiyd | 2:8efdefa03347 | 16 | if(flip == 0) { |
muaiyd | 2:8efdefa03347 | 17 | led1 = !led1; |
muaiyd | 2:8efdefa03347 | 18 | } else { |
muaiyd | 2:8efdefa03347 | 19 | led2 = !led2; |
muaiyd | 2:8efdefa03347 | 20 | } |
muaiyd | 2:8efdefa03347 | 21 | wait(0.1); |
muaiyd | 2:8efdefa03347 | 22 | } |
muaiyd | 0:86bba6bf9b6f | 23 | } |