test

Dependents:   LSI_Compass loop_test CanSat-C_test test

speak.h

Committer:
ushiroji
Date:
2021-10-28
Revision:
1:fe313ebd4f3b
Parent:
0:e190455d7dbb
Child:
3:395d8e8f9051
Child:
4:6dd04e220a4c

File content as of revision 1:fe313ebd4f3b:

#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.printf("\n\rmessage=");
                       int i=0;
                       do{
                           mess[i++]= pc.getc();
                           }while(mess[i-1]!= 0x0d && i<99);
                       //pc.scanf("%s",mess);
                       talk.Synthe(mess);
                       }else{
                           pc.printf("preset_message speak\r\n");
                           talk.Synthe("purissetommese-ji,,konnichiwa.");
                           }
                   }else{
                       pc.printf("Not Active\n");
                   }
}