![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
öpl
Dependencies: mbed
main.cpp@0:b868dbbf6c88, 2015-09-28 (annotated)
- Committer:
- TFuchsbichler
- Date:
- Mon Sep 28 13:43:07 2015 +0000
- Revision:
- 0:b868dbbf6c88
?l?kkl?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
TFuchsbichler | 0:b868dbbf6c88 | 1 | #include "mbed.h" |
TFuchsbichler | 0:b868dbbf6c88 | 2 | |
TFuchsbichler | 0:b868dbbf6c88 | 3 | BusOut myled(LED4,LED3,LED2,LED1); |
TFuchsbichler | 0:b868dbbf6c88 | 4 | |
TFuchsbichler | 0:b868dbbf6c88 | 5 | float delay=0.2; |
TFuchsbichler | 0:b868dbbf6c88 | 6 | |
TFuchsbichler | 0:b868dbbf6c88 | 7 | int main() |
TFuchsbichler | 0:b868dbbf6c88 | 8 | { |
TFuchsbichler | 0:b868dbbf6c88 | 9 | while(1) |
TFuchsbichler | 0:b868dbbf6c88 | 10 | { |
TFuchsbichler | 0:b868dbbf6c88 | 11 | |
TFuchsbichler | 0:b868dbbf6c88 | 12 | for(int i=0;i<=8;i=i*2) |
TFuchsbichler | 0:b868dbbf6c88 | 13 | { |
TFuchsbichler | 0:b868dbbf6c88 | 14 | if(i==0) |
TFuchsbichler | 0:b868dbbf6c88 | 15 | { |
TFuchsbichler | 0:b868dbbf6c88 | 16 | myled=0; |
TFuchsbichler | 0:b868dbbf6c88 | 17 | wait(delay); |
TFuchsbichler | 0:b868dbbf6c88 | 18 | i=i+1; |
TFuchsbichler | 0:b868dbbf6c88 | 19 | } |
TFuchsbichler | 0:b868dbbf6c88 | 20 | myled=i; |
TFuchsbichler | 0:b868dbbf6c88 | 21 | wait(delay); |
TFuchsbichler | 0:b868dbbf6c88 | 22 | |
TFuchsbichler | 0:b868dbbf6c88 | 23 | |
TFuchsbichler | 0:b868dbbf6c88 | 24 | } |
TFuchsbichler | 0:b868dbbf6c88 | 25 | for(int i=8;i>=1;i=i/2) |
TFuchsbichler | 0:b868dbbf6c88 | 26 | { |
TFuchsbichler | 0:b868dbbf6c88 | 27 | if(i==8) |
TFuchsbichler | 0:b868dbbf6c88 | 28 | { |
TFuchsbichler | 0:b868dbbf6c88 | 29 | myled=0; |
TFuchsbichler | 0:b868dbbf6c88 | 30 | wait(delay); |
TFuchsbichler | 0:b868dbbf6c88 | 31 | } |
TFuchsbichler | 0:b868dbbf6c88 | 32 | myled=i; |
TFuchsbichler | 0:b868dbbf6c88 | 33 | wait(delay); |
TFuchsbichler | 0:b868dbbf6c88 | 34 | |
TFuchsbichler | 0:b868dbbf6c88 | 35 | } |
TFuchsbichler | 0:b868dbbf6c88 | 36 | |
TFuchsbichler | 0:b868dbbf6c88 | 37 | } |
TFuchsbichler | 0:b868dbbf6c88 | 38 | } |