Naoki Hasegawa
/
test2
a
test2.cpp@0:e1d7e2bd3570, 2014-06-30 (annotated)
- Committer:
- 12F2041G
- Date:
- Mon Jun 30 04:44:08 2014 +0000
- Revision:
- 0:e1d7e2bd3570
- Child:
- 1:7f3cd64b15e6
a
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
12F2041G | 0:e1d7e2bd3570 | 1 | #include "mbed.h" |
12F2041G | 0:e1d7e2bd3570 | 2 | |
12F2041G | 0:e1d7e2bd3570 | 3 | DigitalOut myled(P1_14); |
12F2041G | 0:e1d7e2bd3570 | 4 | BusOut leds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1); |
12F2041G | 0:e1d7e2bd3570 | 5 | |
12F2041G | 0:e1d7e2bd3570 | 6 | void all(); |
12F2041G | 0:e1d7e2bd3570 | 7 | void rot(); |
12F2041G | 0:e1d7e2bd3570 | 8 | |
12F2041G | 0:e1d7e2bd3570 | 9 | int main() { |
12F2041G | 0:e1d7e2bd3570 | 10 | while(0x01) { |
12F2041G | 0:e1d7e2bd3570 | 11 | myled=0x01; |
12F2041G | 0:e1d7e2bd3570 | 12 | wait(0.2); |
12F2041G | 0:e1d7e2bd3570 | 13 | myled=0x00; |
12F2041G | 0:e1d7e2bd3570 | 14 | wait(0.2); |
12F2041G | 0:e1d7e2bd3570 | 15 | all(); |
12F2041G | 0:e1d7e2bd3570 | 16 | leds=0x00; |
12F2041G | 0:e1d7e2bd3570 | 17 | wait(0.2); |
12F2041G | 0:e1d7e2bd3570 | 18 | rot(); |
12F2041G | 0:e1d7e2bd3570 | 19 | |
12F2041G | 0:e1d7e2bd3570 | 20 | } |
12F2041G | 0:e1d7e2bd3570 | 21 | } |
12F2041G | 0:e1d7e2bd3570 | 22 | |
12F2041G | 0:e1d7e2bd3570 | 23 | void all() |
12F2041G | 0:e1d7e2bd3570 | 24 | { |
12F2041G | 0:e1d7e2bd3570 | 25 | leds = 0x00; |
12F2041G | 0:e1d7e2bd3570 | 26 | wait(0.5); |
12F2041G | 0:e1d7e2bd3570 | 27 | leds = 0xff; |
12F2041G | 0:e1d7e2bd3570 | 28 | wait(0.5); |
12F2041G | 0:e1d7e2bd3570 | 29 | } |
12F2041G | 0:e1d7e2bd3570 | 30 | |
12F2041G | 0:e1d7e2bd3570 | 31 | void rot() |
12F2041G | 0:e1d7e2bd3570 | 32 | { |
12F2041G | 0:e1d7e2bd3570 | 33 | int i; |
12F2041G | 0:e1d7e2bd3570 | 34 | for(i=0x00; i<0x08; i++){ |
12F2041G | 0:e1d7e2bd3570 | 35 | leds = 0x01<<i; |
12F2041G | 0:e1d7e2bd3570 | 36 | wait(0.2); |
12F2041G | 0:e1d7e2bd3570 | 37 | |
12F2041G | 0:e1d7e2bd3570 | 38 | } |
12F2041G | 0:e1d7e2bd3570 | 39 | leds=0x00; |
12F2041G | 0:e1d7e2bd3570 | 40 | wait(0.2); |
12F2041G | 0:e1d7e2bd3570 | 41 | } |