blinking file
Dependencies: mbed
main.cpp@0:c6a5242db54d, 2019-01-21 (annotated)
- Committer:
- CedricMeeuwis
- Date:
- Mon Jan 21 13:30:16 2019 +0000
- Revision:
- 0:c6a5242db54d
blinking
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
CedricMeeuwis | 0:c6a5242db54d | 1 | #include "mbed.h" |
CedricMeeuwis | 0:c6a5242db54d | 2 | |
CedricMeeuwis | 0:c6a5242db54d | 3 | DigitalOut myled(LED1); |
CedricMeeuwis | 0:c6a5242db54d | 4 | |
CedricMeeuwis | 0:c6a5242db54d | 5 | int main() { |
CedricMeeuwis | 0:c6a5242db54d | 6 | double waitTime = 0.2; |
CedricMeeuwis | 0:c6a5242db54d | 7 | while(1) { |
CedricMeeuwis | 0:c6a5242db54d | 8 | myled = 1; |
CedricMeeuwis | 0:c6a5242db54d | 9 | wait(waitTime); |
CedricMeeuwis | 0:c6a5242db54d | 10 | myled = 0; |
CedricMeeuwis | 0:c6a5242db54d | 11 | wait(0.2); |
CedricMeeuwis | 0:c6a5242db54d | 12 | waitTime = waitTime * 2; |
CedricMeeuwis | 0:c6a5242db54d | 13 | if(waitTime > 10){ |
CedricMeeuwis | 0:c6a5242db54d | 14 | waitTime = 0.2; |
CedricMeeuwis | 0:c6a5242db54d | 15 | } |
CedricMeeuwis | 0:c6a5242db54d | 16 | |
CedricMeeuwis | 0:c6a5242db54d | 17 | } |
CedricMeeuwis | 0:c6a5242db54d | 18 | } |