svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
Diff: sound.h
- Revision:
- 17:bd6b6ac89e0e
- Parent:
- 15:960b922433d1
- Child:
- 23:bc05a104be10
--- a/sound.h Sat Dec 01 14:31:24 2018 +0000 +++ b/sound.h Sun Feb 10 12:05:16 2019 +0000 @@ -25,18 +25,21 @@ // sound_in.putc(0x06); //load command 06 to recognizer sound_in.putc(0x0A); } + void voice_command_process(){ if(sound_in.readable()){ + if (myled == 0 ) myled = 1;else myled = 0; char tmc = sound_in.getc(); + wifi.putc(tmc); if (tmc == 0xAA) sound_in_receive_counter = 0; else sound_in_receive_counter++; if(sound_in_receive_counter > 15) sound_in_receive_counter = 15; sound_in_receive_buf[sound_in_receive_counter] = tmc; if (sound_in_receive_counter == 5){ switch(tmc){ - case 0: play(1); break; - case 1: play(1); break; - case 2: play(1); break; - case 3: play(1); break; + case 0: play(rand()%10+1); break; + case 1: play(rand()%10+1); break; + case 2: play(rand()%10+1); break; + case 3: play(rand()%10+1); break; case 4: play(1); break; case 5: play(1); break; case 6: play(1); break; @@ -44,4 +47,8 @@ } } } - \ No newline at end of file + + +/*void sound_in_init(){ + sound_in.attach(&voice_command_receive); + }*/ \ No newline at end of file