Robert Labuz
/
mbed2_3_b_ii
mbed2_3_b_ii
kosz.txt@0:da2fe761ec44, 2017-05-05 (annotated)
- Committer:
- Robsonik16
- Date:
- Fri May 05 19:46:56 2017 +0000
- Revision:
- 0:da2fe761ec44
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Robsonik16 | 0:da2fe761ec44 | 1 | // Blink until timeout. |
Robsonik16 | 0:da2fe761ec44 | 2 | |
Robsonik16 | 0:da2fe761ec44 | 3 | #include "mbed.h" |
Robsonik16 | 0:da2fe761ec44 | 4 | |
Robsonik16 | 0:da2fe761ec44 | 5 | Timeout timeout; |
Robsonik16 | 0:da2fe761ec44 | 6 | DigitalOut led(LED1); |
Robsonik16 | 0:da2fe761ec44 | 7 | |
Robsonik16 | 0:da2fe761ec44 | 8 | int on = 1; |
Robsonik16 | 0:da2fe761ec44 | 9 | |
Robsonik16 | 0:da2fe761ec44 | 10 | void attimeout() { |
Robsonik16 | 0:da2fe761ec44 | 11 | on = 0; |
Robsonik16 | 0:da2fe761ec44 | 12 | } |
Robsonik16 | 0:da2fe761ec44 | 13 | |
Robsonik16 | 0:da2fe761ec44 | 14 | int main() { |
Robsonik16 | 0:da2fe761ec44 | 15 | timeout.attach(&attimeout, 5); |
Robsonik16 | 0:da2fe761ec44 | 16 | while(on) { |
Robsonik16 | 0:da2fe761ec44 | 17 | led = !led; |
Robsonik16 | 0:da2fe761ec44 | 18 | wait(0.2); |
Robsonik16 | 0:da2fe761ec44 | 19 | } |
Robsonik16 | 0:da2fe761ec44 | 20 | } |