masamitsu shibata
/
test5
homework
Revision 2:46e449180029, committed 2014-05-01
- Comitter:
- 12f2025e
- Date:
- Thu May 01 03:59:15 2014 +0000
- Parent:
- 1:3917701817b4
- Commit message:
- homework
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 3917701817b4 -r 46e449180029 main.cpp --- a/main.cpp Mon Apr 21 07:00:37 2014 +0000 +++ b/main.cpp Thu May 01 03:59:15 2014 +0000 @@ -2,61 +2,99 @@ BusOut leds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1); -void rotate(); -void all(); +void rotate1(); +void rotate2(); +void rotate3(); +void all1(); void sitei(); +void all2(); int main() { while(1) { - rotate(); - wait(0.25); - all(); - wait(0.25); + rotate1(); + rotate2(); + rotate3(); + wait(0.2); + all1(); sitei(); - wait(0.25); + all2(); + all2(); + all2(); + all2(); + } +} + +void rotate1() +{ + volatile uint8_t i ; + for(i = 0; i < 8; i++) + { + leds = 1 << i; + wait(0.3); } } -void all() - +void rotate2() { - - leds = 0xff; - wait(0.125); - leds = 0x00; - wait(0.125); - } - - -void rotate() + volatile uint8_t j ; + for(j = 0; j < 7; j=j+2) + { + leds = 192 >> j; + wait(0.3); + } +} + +void rotate3() { - volatile uint8_t i; - for(i = 0x00; i < 8; i++) + volatile uint8_t k ; + for(k = 0; k < 5; k=k+4) { - leds = 1 << i; - wait(0.125); + leds = 15 << k; + wait(0.3); } +} - for(i = 7; i > 0x00; i--) - { - leds = 1 << i; - wait(0.125); - - - } - leds = 0x01; - wait(0.125);\ +void all1() +{ + leds=0xff; + wait(0.5); + leds=0x00; + wait(0.3); } void sitei() { - + leds=0x01; + wait(0.3); + leds=0x80; + wait(0.3); + leds=0x02; + wait(0.3); + leds=0x40; + wait(0.3); + leds=0x04; + wait(0.3); + leds=0x20; + wait(0.3); + leds=0x08; + wait(0.3); + leds=0x10; + wait(0.3); + leds=0x18; + wait(0.3); + leds=0x3c; + wait(0.3); + leds=0x7e; + wait(0.3); +} - leds = 0x04; - wait(0.125); - } - - \ No newline at end of file +void all2() +{ + leds=0xff; + wait(0.125); + leds=0x00; + wait(0.125); +} \ No newline at end of file