レポート 課題5

Dependencies:   mbed

Fork of test1 by 圭祐 杉浦

Committer:
12f2027a
Date:
Fri May 23 08:12:13 2014 +0000
Revision:
1:dd1f5b571cc2
Parent:
0:6cd606287eb8
a

Who changed what in which revision?

UserRevisionLine numberNew contents of line
12f2027a 0:6cd606287eb8 1 #include "mbed.h"
12f2027a 0:6cd606287eb8 2
12f2027a 1:dd1f5b571cc2 3 BusOut myleds(P1_13, P1_14, P1_22, P0_17, P0_18, P0_19, P1_15, P0_1);
12f2027a 1:dd1f5b571cc2 4
12f2027a 1:dd1f5b571cc2 5 void tennmetsu1();
12f2027a 1:dd1f5b571cc2 6 void tennmetsu2();
12f2027a 1:dd1f5b571cc2 7 void tennmetsu3();
12f2027a 1:dd1f5b571cc2 8 void tennmetsu4();
12f2027a 1:dd1f5b571cc2 9 void tennmetsu5();
12f2027a 1:dd1f5b571cc2 10 void tennmetsu6();
12f2027a 1:dd1f5b571cc2 11
12f2027a 1:dd1f5b571cc2 12 int main( )
12f2027a 0:6cd606287eb8 13 {
12f2027a 1:dd1f5b571cc2 14
12f2027a 0:6cd606287eb8 15 while(1)
12f2027a 0:6cd606287eb8 16 {
12f2027a 1:dd1f5b571cc2 17
12f2027a 1:dd1f5b571cc2 18 tennmetsu1();
12f2027a 1:dd1f5b571cc2 19 tennmetsu2();
12f2027a 1:dd1f5b571cc2 20 tennmetsu5();
12f2027a 1:dd1f5b571cc2 21 tennmetsu6();
12f2027a 1:dd1f5b571cc2 22 tennmetsu3();
12f2027a 1:dd1f5b571cc2 23 tennmetsu4();
12f2027a 1:dd1f5b571cc2 24 tennmetsu1();
12f2027a 1:dd1f5b571cc2 25 tennmetsu3();
12f2027a 1:dd1f5b571cc2 26
12f2027a 1:dd1f5b571cc2 27
12f2027a 1:dd1f5b571cc2 28
12f2027a 1:dd1f5b571cc2 29
12f2027a 0:6cd606287eb8 30 }
12f2027a 1:dd1f5b571cc2 31 }
12f2027a 1:dd1f5b571cc2 32
12f2027a 1:dd1f5b571cc2 33 void tennmetsu1()
12f2027a 1:dd1f5b571cc2 34 {
12f2027a 1:dd1f5b571cc2 35 int i;
12f2027a 1:dd1f5b571cc2 36 for( i = 0; i < 2; i++){
12f2027a 1:dd1f5b571cc2 37 myleds = 0xff;
12f2027a 1:dd1f5b571cc2 38 wait(0.2);
12f2027a 1:dd1f5b571cc2 39 myleds = 0x00;
12f2027a 1:dd1f5b571cc2 40 wait(0.2);
12f2027a 1:dd1f5b571cc2 41 }
12f2027a 1:dd1f5b571cc2 42 }
12f2027a 1:dd1f5b571cc2 43
12f2027a 1:dd1f5b571cc2 44 void tennmetsu2()
12f2027a 1:dd1f5b571cc2 45 {
12f2027a 1:dd1f5b571cc2 46 int j;
12f2027a 1:dd1f5b571cc2 47 volatile uint8_t a;
12f2027a 1:dd1f5b571cc2 48 for( j = 0; j < 2; j++){
12f2027a 1:dd1f5b571cc2 49 for( a = 0; a < 8; a++){
12f2027a 1:dd1f5b571cc2 50 myleds = 256 >> a;
12f2027a 1:dd1f5b571cc2 51 wait(0.15);
12f2027a 1:dd1f5b571cc2 52 }
12f2027a 1:dd1f5b571cc2 53 for( a = 0; a < 8; a++){
12f2027a 1:dd1f5b571cc2 54 myleds = 1 << a;
12f2027a 1:dd1f5b571cc2 55 wait(0.15);
12f2027a 1:dd1f5b571cc2 56 }
12f2027a 1:dd1f5b571cc2 57 }
12f2027a 0:6cd606287eb8 58 }
12f2027a 0:6cd606287eb8 59
12f2027a 0:6cd606287eb8 60
12f2027a 1:dd1f5b571cc2 61 void tennmetsu3()
12f2027a 1:dd1f5b571cc2 62 {
12f2027a 1:dd1f5b571cc2 63 myleds = 0xc3;
12f2027a 1:dd1f5b571cc2 64 wait(0.2);
12f2027a 1:dd1f5b571cc2 65 myleds = 0x3c;
12f2027a 1:dd1f5b571cc2 66 wait(0.2);
12f2027a 1:dd1f5b571cc2 67 myleds = 0xc3;
12f2027a 1:dd1f5b571cc2 68 wait(0.2);
12f2027a 1:dd1f5b571cc2 69 myleds = 0x3c;
12f2027a 1:dd1f5b571cc2 70 wait(0.2);
12f2027a 1:dd1f5b571cc2 71 myleds = 0x81;
12f2027a 1:dd1f5b571cc2 72 wait(0.2);
12f2027a 1:dd1f5b571cc2 73 myleds = 0x42;
12f2027a 1:dd1f5b571cc2 74 wait(0.2);
12f2027a 1:dd1f5b571cc2 75 myleds = 0x18;
12f2027a 1:dd1f5b571cc2 76 wait(0.2);
12f2027a 1:dd1f5b571cc2 77 myleds = 0x24;
12f2027a 1:dd1f5b571cc2 78 wait(0.2);
12f2027a 1:dd1f5b571cc2 79 myleds = 0x42;
12f2027a 1:dd1f5b571cc2 80 wait(0.2);
12f2027a 1:dd1f5b571cc2 81 myleds = 0x81;
12f2027a 1:dd1f5b571cc2 82 wait(0.2);
12f2027a 1:dd1f5b571cc2 83 }
12f2027a 0:6cd606287eb8 84
12f2027a 1:dd1f5b571cc2 85 void tennmetsu4()
12f2027a 0:6cd606287eb8 86 {
12f2027a 1:dd1f5b571cc2 87 myleds = 0x90;
12f2027a 1:dd1f5b571cc2 88 wait(0.2);
12f2027a 1:dd1f5b571cc2 89 myleds = 0x09;
12f2027a 1:dd1f5b571cc2 90 wait(0.2);
12f2027a 1:dd1f5b571cc2 91 myleds = 0x99;
12f2027a 1:dd1f5b571cc2 92 wait(0.2);
12f2027a 1:dd1f5b571cc2 93 myleds = 0x66;
12f2027a 1:dd1f5b571cc2 94 wait(0.2);
12f2027a 1:dd1f5b571cc2 95 myleds = 0x60;
12f2027a 1:dd1f5b571cc2 96 wait(0.2);
12f2027a 1:dd1f5b571cc2 97 myleds = 0x06;
12f2027a 1:dd1f5b571cc2 98 wait(0.2);
12f2027a 1:dd1f5b571cc2 99
12f2027a 1:dd1f5b571cc2 100 }
12f2027a 1:dd1f5b571cc2 101
12f2027a 1:dd1f5b571cc2 102 void tennmetsu5()
12f2027a 1:dd1f5b571cc2 103 {
12f2027a 1:dd1f5b571cc2 104 myleds = 0xa2;
12f2027a 1:dd1f5b571cc2 105 wait(0.2);
12f2027a 1:dd1f5b571cc2 106 myleds = 0x2e;
12f2027a 1:dd1f5b571cc2 107 wait(0.2);
12f2027a 1:dd1f5b571cc2 108 myleds = 0xec;
12f2027a 1:dd1f5b571cc2 109 wait(0.2);
12f2027a 1:dd1f5b571cc2 110 myleds = 0xb9;
12f2027a 1:dd1f5b571cc2 111 wait(0.2);
12f2027a 1:dd1f5b571cc2 112 myleds = 0x6d;
12f2027a 1:dd1f5b571cc2 113 wait(0.2);
12f2027a 1:dd1f5b571cc2 114 myleds = 0x11;
12f2027a 1:dd1f5b571cc2 115 wait(0.2);
12f2027a 1:dd1f5b571cc2 116 }
12f2027a 1:dd1f5b571cc2 117
12f2027a 1:dd1f5b571cc2 118 void tennmetsu6()
12f2027a 1:dd1f5b571cc2 119 {
12f2027a 1:dd1f5b571cc2 120 int j;
12f2027a 1:dd1f5b571cc2 121 int k;
12f2027a 1:dd1f5b571cc2 122 volatile uint8_t a;
12f2027a 1:dd1f5b571cc2 123 for( j = 0; j < 3; j++){
12f2027a 1:dd1f5b571cc2 124 for( a = 0; a < 8; a++){
12f2027a 1:dd1f5b571cc2 125 myleds = 256 >> a;
12f2027a 1:dd1f5b571cc2 126 wait(0.05);
12f2027a 1:dd1f5b571cc2 127 }
12f2027a 1:dd1f5b571cc2 128 }
12f2027a 1:dd1f5b571cc2 129 for( k = 0; k < 3; k++){
12f2027a 1:dd1f5b571cc2 130 for( a = 0; a < 8; a++){
12f2027a 1:dd1f5b571cc2 131 myleds = 1 << a;
12f2027a 1:dd1f5b571cc2 132 wait(0.05);
12f2027a 1:dd1f5b571cc2 133 }
12f2027a 0:6cd606287eb8 134 }
12f2027a 0:6cd606287eb8 135 }