svoe
Dependencies: mbed mbed-STM32F103C8T6 MPU6050_1
Diff: sound.h
- Revision:
- 6:6e89cdc3db92
- Child:
- 15:960b922433d1
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sound.h Sun May 21 12:04:00 2017 +0000 @@ -0,0 +1,12 @@ +//char sound_send_buf[10]= {0x7E, 0xFF, 06, 00, 00, 00, 00, 00, 00, 0xEF}; +char sound_send_buf[10]= {0x7E, 0xFF, 06, 03, 00, 00, 00, 00, 00, 0xEF}; + +void play(short int record_num){ + sound_send_buf[5] = (char)(record_num >> 8); //high byte + sound_send_buf[6] = (char)record_num; //low byte + short int sum = 0; + for (int i=1; i<7; i++) sum += sound_send_buf[i]; + sound_send_buf[7] = (char)(sum >> 8); //high byte + sound_send_buf[8] = (char)sum; //low byte + for (int i = 0; i < 10; i++) pc.putc(sound_send_buf[i]); + }