test

Dependents:   LSI_Compass loop_test CanSat-C_test test

speak.h

Committer:
ushiroji
Date:
2021-11-04
Revision:
4:6dd04e220a4c
Parent:
1:fe313ebd4f3b

File content as of revision 4:6dd04e220a4c:

#include "ATP3011.h"

ATP3011 talk(D4,D5); // I2C sda scl
 
 /*地上局から新情報を送るときはflag=がでてきたらスペースか.を入力
 3秒後ぐらいにmessage=が出てくるので、そしたら新情報を入力*/
void speak()
{
    int timeout_ms=500;
    char mess[100];            
        if(talk.IsActive(timeout_ms)==true){
            pc.printf("Active\n\rflag=");
            wait(3);
                if(pc.readable()){      //pc.readable()
                pc.printf("\n\rmessage=");
                int i=0;
                    do{
                        //mess[i++]= pc.getc();
                        mess[i++]= pc.getc();
                    }
                    while(mess[i-1]!= 0x0d && i<99);
                talk.Synthe(mess);
            }
            else{
                pc.printf("preset_message speak\r\n");
                talk.Synthe("purissetommese-ji,,konnichiwa.");
            }
        }
        else{
            pc.printf("Not Active\n");
        }
}