テスト
Dependencies: C12832 USBHost mbed MMA7660 wave_player
Fork of app-board-Speaker by
main.cpp@11:5e85ab7d4176, 2016-12-12 (annotated)
- Committer:
- max_0630
- Date:
- Mon Dec 12 07:02:14 2016 +0000
- Revision:
- 11:5e85ab7d4176
- Parent:
- 10:5fb0cef92e1b
- Child:
- 12:c1148331b151
new
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
funa0825 | 3:b1115b34e95b | 1 | |
funa0825 | 3:b1115b34e95b | 2 | |
funa0825 | 3:b1115b34e95b | 3 | #define mC 261.626 |
funa0825 | 3:b1115b34e95b | 4 | #define mD 293.665 |
funa0825 | 3:b1115b34e95b | 5 | #define mE 329.628 |
funa0825 | 3:b1115b34e95b | 6 | #define mF 349.228 |
funa0825 | 3:b1115b34e95b | 7 | #define mG 391.995 |
funa0825 | 3:b1115b34e95b | 8 | #define mA 440.000 |
funa0825 | 3:b1115b34e95b | 9 | #define mB 493.883 |
funa0825 | 3:b1115b34e95b | 10 | #define THRESH 80 |
max_0630 | 5:04b0c694b5a1 | 11 | #define COUNT_MAX 15 |
toyohara | 6:82aa8f2c3c47 | 12 | #define DIM 3 |
funa0825 | 3:b1115b34e95b | 13 | #include "C12832.h" |
chris | 0:f86c572491c3 | 14 | #include "mbed.h" |
funa0825 | 3:b1115b34e95b | 15 | #include "rtos.h" |
toyohara | 6:82aa8f2c3c47 | 16 | #include "MMA7660.h" |
toyohara | 10:5fb0cef92e1b | 17 | #include "USBHostMSD.h" |
toyohara | 10:5fb0cef92e1b | 18 | #include "wave_player.h" |
chris | 0:f86c572491c3 | 19 | |
funa0825 | 3:b1115b34e95b | 20 | C12832 lcd(p5, p7, p6, p8, p11); |
chris | 1:0a08d26b011a | 21 | DigitalIn fire(p14); |
funa0825 | 3:b1115b34e95b | 22 | //DigitalIn up(p15); |
funa0825 | 3:b1115b34e95b | 23 | //DigitalIn down(p12); |
funa0825 | 3:b1115b34e95b | 24 | PwmOut sp1(p26); |
funa0825 | 3:b1115b34e95b | 25 | InterruptIn myup(p15); |
funa0825 | 3:b1115b34e95b | 26 | InterruptIn mydown(p12); |
funa0825 | 3:b1115b34e95b | 27 | PwmOut led1(p23); |
funa0825 | 3:b1115b34e95b | 28 | PwmOut led2(p24); |
funa0825 | 3:b1115b34e95b | 29 | PwmOut led3(p25); |
funa0825 | 3:b1115b34e95b | 30 | Semaphore three_slots(1); |
funa0825 | 3:b1115b34e95b | 31 | Timer for_chat; |
max_0630 | 11:5e85ab7d4176 | 32 | AnalogIn mypotentiometer(p19); |
chris | 0:f86c572491c3 | 33 | |
toyohara | 6:82aa8f2c3c47 | 34 | //for acceleration sonsor |
toyohara | 6:82aa8f2c3c47 | 35 | MMA7660 acc(p28, p27); |
toyohara | 6:82aa8f2c3c47 | 36 | float r[DIM]; |
toyohara | 6:82aa8f2c3c47 | 37 | |
toyohara | 10:5fb0cef92e1b | 38 | //for music |
toyohara | 10:5fb0cef92e1b | 39 | AnalogOut DACout (p18); |
toyohara | 10:5fb0cef92e1b | 40 | wave_player waver(&DACout, &sp1); |
toyohara | 10:5fb0cef92e1b | 41 | |
funa0825 | 3:b1115b34e95b | 42 | int i=0; |
max_0630 | 5:04b0c694b5a1 | 43 | int count = 0; |
max_0630 | 5:04b0c694b5a1 | 44 | |
funa0825 | 3:b1115b34e95b | 45 | float mm[]={mC,mD,mE,mF,mG,mA,mB,mC*2,mD*2,mE*2,mF*2,mG*2,mA*2,mB*2,mC*4}; |
funa0825 | 3:b1115b34e95b | 46 | void intRise(void) |
funa0825 | 3:b1115b34e95b | 47 | { |
funa0825 | 3:b1115b34e95b | 48 | if(for_chat.read_ms()>THRESH); |
funa0825 | 3:b1115b34e95b | 49 | { |
max_0630 | 5:04b0c694b5a1 | 50 | if(i<=13){ |
funa0825 | 3:b1115b34e95b | 51 | i++; |
max_0630 | 5:04b0c694b5a1 | 52 | count ++; |
max_0630 | 5:04b0c694b5a1 | 53 | } |
funa0825 | 3:b1115b34e95b | 54 | sp1.period(1.0/mm[i]); |
funa0825 | 3:b1115b34e95b | 55 | sp1.write(0.5f); |
funa0825 | 3:b1115b34e95b | 56 | for_chat.reset(); |
funa0825 | 3:b1115b34e95b | 57 | } |
funa0825 | 3:b1115b34e95b | 58 | } |
funa0825 | 3:b1115b34e95b | 59 | |
funa0825 | 3:b1115b34e95b | 60 | void intFall(void) |
funa0825 | 3:b1115b34e95b | 61 | { |
funa0825 | 3:b1115b34e95b | 62 | if(for_chat.read_ms()>THRESH); |
funa0825 | 3:b1115b34e95b | 63 | { |
max_0630 | 5:04b0c694b5a1 | 64 | if(i >=1){ |
funa0825 | 3:b1115b34e95b | 65 | i--; |
max_0630 | 5:04b0c694b5a1 | 66 | count --; |
max_0630 | 5:04b0c694b5a1 | 67 | } |
funa0825 | 3:b1115b34e95b | 68 | sp1.period(1.0/mm[i]); |
funa0825 | 3:b1115b34e95b | 69 | sp1.write(0.5f); |
funa0825 | 3:b1115b34e95b | 70 | for_chat.reset(); |
funa0825 | 3:b1115b34e95b | 71 | } |
funa0825 | 3:b1115b34e95b | 72 | } |
funa0825 | 3:b1115b34e95b | 73 | |
funa0825 | 3:b1115b34e95b | 74 | |
funa0825 | 3:b1115b34e95b | 75 | void r_thread(void const *argument) |
funa0825 | 3:b1115b34e95b | 76 | { |
funa0825 | 3:b1115b34e95b | 77 | float r = 0; |
funa0825 | 3:b1115b34e95b | 78 | while (true) |
funa0825 | 3:b1115b34e95b | 79 | { |
funa0825 | 3:b1115b34e95b | 80 | r=0; |
funa0825 | 3:b1115b34e95b | 81 | while(r<=1) |
funa0825 | 3:b1115b34e95b | 82 | { |
funa0825 | 3:b1115b34e95b | 83 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 84 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 85 | case 0:r = 0.0;break; |
max_0630 | 5:04b0c694b5a1 | 86 | case 1:r=0.07;break; |
max_0630 | 5:04b0c694b5a1 | 87 | case 2:r=0.13;break; |
max_0630 | 5:04b0c694b5a1 | 88 | case 3:r=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 89 | case 4:r=0.27;break; |
max_0630 | 5:04b0c694b5a1 | 90 | case 5:r=0.34;break; |
max_0630 | 5:04b0c694b5a1 | 91 | case 6:r=0.41;break; |
max_0630 | 5:04b0c694b5a1 | 92 | case 7:r=0.48;break; |
max_0630 | 5:04b0c694b5a1 | 93 | case 8:r=0.55;break; |
max_0630 | 5:04b0c694b5a1 | 94 | case 9:r=0.62;break; |
max_0630 | 5:04b0c694b5a1 | 95 | case 10:r=0.69;break; |
max_0630 | 5:04b0c694b5a1 | 96 | case 11:r=0.76;break; |
max_0630 | 5:04b0c694b5a1 | 97 | case 12:r=0.83;break; |
max_0630 | 5:04b0c694b5a1 | 98 | case 13:r=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 99 | case 14:r=0.97;break; |
max_0630 | 5:04b0c694b5a1 | 100 | } |
max_0630 | 5:04b0c694b5a1 | 101 | //r = (float)(count%COUNT_MAX)/COUNT_MAX; |
funa0825 | 3:b1115b34e95b | 102 | led1 = r; |
max_0630 | 5:04b0c694b5a1 | 103 | //r += 0.01; |
funa0825 | 3:b1115b34e95b | 104 | lcd.locate(0,16); |
funa0825 | 3:b1115b34e95b | 105 | lcd.printf("R: %3.2f",r); |
funa0825 | 3:b1115b34e95b | 106 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 107 | Thread::wait(100); |
funa0825 | 3:b1115b34e95b | 108 | |
funa0825 | 3:b1115b34e95b | 109 | } |
funa0825 | 3:b1115b34e95b | 110 | while(r>0) |
funa0825 | 3:b1115b34e95b | 111 | { |
funa0825 | 3:b1115b34e95b | 112 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 113 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 114 | case 0:r = 0.0;break; |
max_0630 | 5:04b0c694b5a1 | 115 | case 1:r=0.07;break; |
max_0630 | 5:04b0c694b5a1 | 116 | case 2:r=0.13;break; |
max_0630 | 5:04b0c694b5a1 | 117 | case 3:r=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 118 | case 4:r=0.27;break; |
max_0630 | 5:04b0c694b5a1 | 119 | case 5:r=0.34;break; |
max_0630 | 5:04b0c694b5a1 | 120 | case 6:r=0.41;break; |
max_0630 | 5:04b0c694b5a1 | 121 | case 7:r=0.48;break; |
max_0630 | 5:04b0c694b5a1 | 122 | case 8:r=0.55;break; |
max_0630 | 5:04b0c694b5a1 | 123 | case 9:r=0.62;break; |
max_0630 | 5:04b0c694b5a1 | 124 | case 10:r=0.69;break; |
max_0630 | 5:04b0c694b5a1 | 125 | case 11:r=0.76;break; |
max_0630 | 5:04b0c694b5a1 | 126 | case 12:r=0.83;break; |
max_0630 | 5:04b0c694b5a1 | 127 | case 13:r=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 128 | case 14:r=0.97;break; |
max_0630 | 5:04b0c694b5a1 | 129 | } |
max_0630 | 5:04b0c694b5a1 | 130 | //r = (float)(count%COUNT_MAX)/COUNT_MAX; |
funa0825 | 3:b1115b34e95b | 131 | led1 = r; |
max_0630 | 5:04b0c694b5a1 | 132 | //r -= 0.01; |
funa0825 | 3:b1115b34e95b | 133 | lcd.locate(0,16); |
funa0825 | 3:b1115b34e95b | 134 | lcd.printf("R: %3.2f",r); |
funa0825 | 3:b1115b34e95b | 135 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 136 | Thread::wait(100); |
funa0825 | 3:b1115b34e95b | 137 | |
funa0825 | 3:b1115b34e95b | 138 | } |
funa0825 | 3:b1115b34e95b | 139 | } |
funa0825 | 3:b1115b34e95b | 140 | } |
funa0825 | 3:b1115b34e95b | 141 | void g_thread(void const *argument) |
chris | 0:f86c572491c3 | 142 | { |
funa0825 | 3:b1115b34e95b | 143 | float g = 0; |
funa0825 | 3:b1115b34e95b | 144 | while (true) |
funa0825 | 3:b1115b34e95b | 145 | { |
funa0825 | 3:b1115b34e95b | 146 | g=0; |
funa0825 | 3:b1115b34e95b | 147 | while(g<=1) |
funa0825 | 3:b1115b34e95b | 148 | { |
funa0825 | 3:b1115b34e95b | 149 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 150 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 151 | case 0:g = 0.50;break; |
max_0630 | 5:04b0c694b5a1 | 152 | case 1:g = 0.50;break; |
max_0630 | 5:04b0c694b5a1 | 153 | case 2:g=0.63;break; |
max_0630 | 5:04b0c694b5a1 | 154 | case 3:g=0.63;break; |
max_0630 | 5:04b0c694b5a1 | 155 | case 4:g=0.77;break; |
max_0630 | 5:04b0c694b5a1 | 156 | case 5:g=0.77;break; |
max_0630 | 5:04b0c694b5a1 | 157 | case 6:g=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 158 | case 7:g=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 159 | case 8:g=0.47;break; |
max_0630 | 5:04b0c694b5a1 | 160 | case 9:g=0.47;break; |
max_0630 | 5:04b0c694b5a1 | 161 | case 10:g=0.33;break; |
max_0630 | 5:04b0c694b5a1 | 162 | case 11:g=0.33;break; |
max_0630 | 5:04b0c694b5a1 | 163 | case 12:g=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 164 | case 13:g=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 165 | case 14:g=0.07;break; |
max_0630 | 5:04b0c694b5a1 | 166 | } |
funa0825 | 3:b1115b34e95b | 167 | led2 = g; |
max_0630 | 5:04b0c694b5a1 | 168 | //g += 0.01; |
funa0825 | 3:b1115b34e95b | 169 | lcd.locate(40,16); |
funa0825 | 3:b1115b34e95b | 170 | lcd.printf("G: %3.2f",g); |
funa0825 | 3:b1115b34e95b | 171 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 172 | Thread::wait(200); |
funa0825 | 3:b1115b34e95b | 173 | } |
funa0825 | 3:b1115b34e95b | 174 | while(g>0) |
funa0825 | 3:b1115b34e95b | 175 | { |
funa0825 | 3:b1115b34e95b | 176 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 177 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 178 | case 0:g = 0.50;break; |
max_0630 | 5:04b0c694b5a1 | 179 | case 1:g = 0.50;break; |
max_0630 | 5:04b0c694b5a1 | 180 | case 2:g=0.63;break; |
max_0630 | 5:04b0c694b5a1 | 181 | case 3:g=0.63;break; |
max_0630 | 5:04b0c694b5a1 | 182 | case 4:g=0.77;break; |
max_0630 | 5:04b0c694b5a1 | 183 | case 5:g=0.77;break; |
max_0630 | 5:04b0c694b5a1 | 184 | case 6:g=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 185 | case 7:g=0.90;break; |
max_0630 | 5:04b0c694b5a1 | 186 | case 8:g=0.47;break; |
max_0630 | 5:04b0c694b5a1 | 187 | case 9:g=0.47;break; |
max_0630 | 5:04b0c694b5a1 | 188 | case 10:g=0.33;break; |
max_0630 | 5:04b0c694b5a1 | 189 | case 11:g=0.33;break; |
max_0630 | 5:04b0c694b5a1 | 190 | case 12:g=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 191 | case 13:g=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 192 | case 14:g=0.07;break; |
max_0630 | 5:04b0c694b5a1 | 193 | } |
funa0825 | 3:b1115b34e95b | 194 | led2 = g; |
max_0630 | 5:04b0c694b5a1 | 195 | //g -= 0.01; |
funa0825 | 3:b1115b34e95b | 196 | lcd.locate(40,16); |
funa0825 | 3:b1115b34e95b | 197 | lcd.printf("G: %3.2f",g); |
funa0825 | 3:b1115b34e95b | 198 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 199 | Thread::wait(200); |
funa0825 | 3:b1115b34e95b | 200 | } |
funa0825 | 3:b1115b34e95b | 201 | } |
funa0825 | 3:b1115b34e95b | 202 | } |
funa0825 | 3:b1115b34e95b | 203 | void b_thread(void const *argument) |
funa0825 | 3:b1115b34e95b | 204 | { |
funa0825 | 3:b1115b34e95b | 205 | float b = 0; |
funa0825 | 3:b1115b34e95b | 206 | while (true) |
funa0825 | 3:b1115b34e95b | 207 | { |
funa0825 | 3:b1115b34e95b | 208 | b=0; |
funa0825 | 3:b1115b34e95b | 209 | while(b<=1) |
funa0825 | 3:b1115b34e95b | 210 | { |
funa0825 | 3:b1115b34e95b | 211 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 212 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 213 | case 0:b = 1.00;break; |
max_0630 | 5:04b0c694b5a1 | 214 | case 1:b = 1.00;break; |
max_0630 | 5:04b0c694b5a1 | 215 | case 2:b=1.00;break; |
max_0630 | 5:04b0c694b5a1 | 216 | case 3:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 217 | case 4:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 218 | case 5:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 219 | case 6:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 220 | case 7:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 221 | case 8:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 222 | case 9:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 223 | case 10:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 224 | case 11:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 225 | case 12:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 226 | case 13:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 227 | case 14:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 228 | } |
funa0825 | 3:b1115b34e95b | 229 | led3 = b; |
max_0630 | 5:04b0c694b5a1 | 230 | //b += 0.01; |
funa0825 | 3:b1115b34e95b | 231 | lcd.locate(80,16); |
funa0825 | 3:b1115b34e95b | 232 | lcd.printf("B: %3.2f",b); |
funa0825 | 3:b1115b34e95b | 233 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 234 | Thread::wait(300); |
chris | 2:cfd337edff08 | 235 | } |
funa0825 | 3:b1115b34e95b | 236 | while(b>0) |
funa0825 | 3:b1115b34e95b | 237 | { |
funa0825 | 3:b1115b34e95b | 238 | three_slots.wait(); |
max_0630 | 5:04b0c694b5a1 | 239 | switch(count){ |
max_0630 | 5:04b0c694b5a1 | 240 | case 0:b = 1.00;break; |
max_0630 | 5:04b0c694b5a1 | 241 | case 1:b = 1.00;break; |
max_0630 | 5:04b0c694b5a1 | 242 | case 2:b=1.00;break; |
max_0630 | 5:04b0c694b5a1 | 243 | case 3:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 244 | case 4:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 245 | case 5:b=0.80;break; |
max_0630 | 5:04b0c694b5a1 | 246 | case 6:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 247 | case 7:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 248 | case 8:b=0.60;break; |
max_0630 | 5:04b0c694b5a1 | 249 | case 9:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 250 | case 10:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 251 | case 11:b=0.40;break; |
max_0630 | 5:04b0c694b5a1 | 252 | case 12:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 253 | case 13:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 254 | case 14:b=0.20;break; |
max_0630 | 5:04b0c694b5a1 | 255 | } |
funa0825 | 3:b1115b34e95b | 256 | led3 = b; |
max_0630 | 5:04b0c694b5a1 | 257 | //b -= 0.01; |
funa0825 | 3:b1115b34e95b | 258 | lcd.locate(80,16); |
funa0825 | 3:b1115b34e95b | 259 | lcd.printf("B: %3.2f",b); |
funa0825 | 3:b1115b34e95b | 260 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 261 | Thread::wait(300); |
funa0825 | 3:b1115b34e95b | 262 | } |
funa0825 | 3:b1115b34e95b | 263 | } |
funa0825 | 3:b1115b34e95b | 264 | } |
funa0825 | 3:b1115b34e95b | 265 | void count_thread(void const *argument) |
funa0825 | 3:b1115b34e95b | 266 | { |
funa0825 | 3:b1115b34e95b | 267 | while (true) |
funa0825 | 3:b1115b34e95b | 268 | { |
funa0825 | 3:b1115b34e95b | 269 | three_slots.wait(); |
funa0825 | 3:b1115b34e95b | 270 | lcd.locate(0,3); |
max_0630 | 5:04b0c694b5a1 | 271 | lcd.printf("Counting : %d ",i); |
funa0825 | 3:b1115b34e95b | 272 | three_slots.release(); |
funa0825 | 3:b1115b34e95b | 273 | Thread::wait(100); |
chris | 0:f86c572491c3 | 274 | } |
funa0825 | 3:b1115b34e95b | 275 | } |
toyohara | 6:82aa8f2c3c47 | 276 | |
toyohara | 6:82aa8f2c3c47 | 277 | void acc_thread(void const *argument) |
toyohara | 6:82aa8f2c3c47 | 278 | { |
toyohara | 6:82aa8f2c3c47 | 279 | while (true) |
toyohara | 6:82aa8f2c3c47 | 280 | { |
toyohara | 6:82aa8f2c3c47 | 281 | acc.readData(r); |
toyohara | 6:82aa8f2c3c47 | 282 | lcd.locate(0,0); |
toyohara | 6:82aa8f2c3c47 | 283 | lcd.printf("x = %f", r[0]); |
toyohara | 6:82aa8f2c3c47 | 284 | lcd.locate(0,10); |
toyohara | 6:82aa8f2c3c47 | 285 | lcd.printf("y = %f", r[1]); |
toyohara | 6:82aa8f2c3c47 | 286 | lcd.locate(0,20); |
toyohara | 6:82aa8f2c3c47 | 287 | lcd.printf("z = %f", r[2]); |
toyohara | 6:82aa8f2c3c47 | 288 | Thread::wait(10); |
toyohara | 6:82aa8f2c3c47 | 289 | } |
toyohara | 6:82aa8f2c3c47 | 290 | } |
toyohara | 6:82aa8f2c3c47 | 291 | |
max_0630 | 11:5e85ab7d4176 | 292 | void disp_thread(void const *argument) |
max_0630 | 11:5e85ab7d4176 | 293 | { |
max_0630 | 11:5e85ab7d4176 | 294 | float mpmeter; |
max_0630 | 11:5e85ab7d4176 | 295 | while (true) |
max_0630 | 11:5e85ab7d4176 | 296 | { |
max_0630 | 11:5e85ab7d4176 | 297 | mpmeter = mypotentiometer.read(); |
max_0630 | 11:5e85ab7d4176 | 298 | //wait(mpmeter); |
max_0630 | 11:5e85ab7d4176 | 299 | lcd.locate(0,10); |
max_0630 | 11:5e85ab7d4176 | 300 | lcd.printf("mpmeter = %f", mpmeter); |
max_0630 | 11:5e85ab7d4176 | 301 | //wait(mpmeter); |
max_0630 | 11:5e85ab7d4176 | 302 | //Thread::wait(10); |
max_0630 | 11:5e85ab7d4176 | 303 | } |
max_0630 | 11:5e85ab7d4176 | 304 | } |
max_0630 | 11:5e85ab7d4176 | 305 | |
funa0825 | 3:b1115b34e95b | 306 | int main() |
funa0825 | 3:b1115b34e95b | 307 | { |
funa0825 | 3:b1115b34e95b | 308 | wait(0.01); |
funa0825 | 3:b1115b34e95b | 309 | for_chat.start(); |
funa0825 | 3:b1115b34e95b | 310 | myup.fall(&intRise); |
funa0825 | 3:b1115b34e95b | 311 | mydown.fall(&intFall); |
toyohara | 6:82aa8f2c3c47 | 312 | //Thread thread1(r_thread,(void *)"Th 1"); |
toyohara | 6:82aa8f2c3c47 | 313 | //Thread thread2(g_thread,(void *)"Th 2"); |
toyohara | 6:82aa8f2c3c47 | 314 | //Thread thread3(b_thread,(void *)"Th 3"); |
toyohara | 6:82aa8f2c3c47 | 315 | //Thread thread4(count_thread,(void *)"Th 4"); |
max_0630 | 11:5e85ab7d4176 | 316 | //Thread thread5(acc_thread,(void *)"Th 5"); |
max_0630 | 11:5e85ab7d4176 | 317 | Thread thread6(disp_thread, (void *)"Th 6"); |
funa0825 | 3:b1115b34e95b | 318 | |
toyohara | 10:5fb0cef92e1b | 319 | //for USB |
toyohara | 10:5fb0cef92e1b | 320 | USBHostMSD msd("usb"); |
toyohara | 10:5fb0cef92e1b | 321 | while(!msd.connect()) |
toyohara | 10:5fb0cef92e1b | 322 | { |
toyohara | 10:5fb0cef92e1b | 323 | Thread::wait(200); |
toyohara | 10:5fb0cef92e1b | 324 | } |
toyohara | 10:5fb0cef92e1b | 325 | |
toyohara | 10:5fb0cef92e1b | 326 | //for music file |
toyohara | 10:5fb0cef92e1b | 327 | FILE *wave_file; |
max_0630 | 11:5e85ab7d4176 | 328 | //sp1.period(1.0 / 400000.0); |
max_0630 | 11:5e85ab7d4176 | 329 | wave_file = fopen("/usb/music/BGMforMBED2-lowQ.wav", "r"); |
toyohara | 10:5fb0cef92e1b | 330 | waver.play(wave_file); |
toyohara | 10:5fb0cef92e1b | 331 | fclose(wave_file); |
toyohara | 10:5fb0cef92e1b | 332 | |
funa0825 | 3:b1115b34e95b | 333 | lcd.cls(); |
funa0825 | 3:b1115b34e95b | 334 | wait(0.01); |
funa0825 | 3:b1115b34e95b | 335 | while(1) |
funa0825 | 3:b1115b34e95b | 336 | { |
funa0825 | 3:b1115b34e95b | 337 | //lcd.cls(); |
funa0825 | 3:b1115b34e95b | 338 | |
funa0825 | 3:b1115b34e95b | 339 | } |
funa0825 | 3:b1115b34e95b | 340 | } |
funa0825 | 3:b1115b34e95b | 341 |