svoe

Dependencies:   mbed mbed-STM32F103C8T6 MPU6050_1

sound.h

Committer:
Stas285
Date:
2017-05-21
Revision:
6:6e89cdc3db92
Child:
15:960b922433d1

File content as of revision 6:6e89cdc3db92:

//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]);
    }