test

Dependents:   LSI_Compass loop_test CanSat-C_test test

Committer:
ushiroji
Date:
Thu Nov 04 11:34:27 2021 +0000
Revision:
4:6dd04e220a4c
Parent:
1:fe313ebd4f3b
test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ushiroji 0:e190455d7dbb 1 #include "ATP3011.h"
ushiroji 0:e190455d7dbb 2
ushiroji 0:e190455d7dbb 3 ATP3011 talk(D4,D5); // I2C sda scl
ushiroji 0:e190455d7dbb 4
ushiroji 0:e190455d7dbb 5 /*地上局から新情報を送るときはflag=がでてきたらスペースか.を入力
ushiroji 0:e190455d7dbb 6 3秒後ぐらいにmessage=が出てくるので、そしたら新情報を入力*/
ushiroji 4:6dd04e220a4c 7 void speak()
ushiroji 4:6dd04e220a4c 8 {
ushiroji 4:6dd04e220a4c 9 int timeout_ms=500;
ushiroji 4:6dd04e220a4c 10 char mess[100];
ushiroji 4:6dd04e220a4c 11 if(talk.IsActive(timeout_ms)==true){
ushiroji 4:6dd04e220a4c 12 pc.printf("Active\n\rflag=");
ushiroji 4:6dd04e220a4c 13 wait(3);
ushiroji 4:6dd04e220a4c 14 if(pc.readable()){ //pc.readable()
ushiroji 4:6dd04e220a4c 15 pc.printf("\n\rmessage=");
ushiroji 4:6dd04e220a4c 16 int i=0;
ushiroji 4:6dd04e220a4c 17 do{
ushiroji 4:6dd04e220a4c 18 //mess[i++]= pc.getc();
ushiroji 4:6dd04e220a4c 19 mess[i++]= pc.getc();
ushiroji 4:6dd04e220a4c 20 }
ushiroji 4:6dd04e220a4c 21 while(mess[i-1]!= 0x0d && i<99);
ushiroji 4:6dd04e220a4c 22 talk.Synthe(mess);
ushiroji 4:6dd04e220a4c 23 }
ushiroji 4:6dd04e220a4c 24 else{
ushiroji 4:6dd04e220a4c 25 pc.printf("preset_message speak\r\n");
ushiroji 4:6dd04e220a4c 26 talk.Synthe("purissetommese-ji,,konnichiwa.");
ushiroji 4:6dd04e220a4c 27 }
ushiroji 4:6dd04e220a4c 28 }
ushiroji 4:6dd04e220a4c 29 else{
ushiroji 4:6dd04e220a4c 30 pc.printf("Not Active\n");
ushiroji 4:6dd04e220a4c 31 }
ushiroji 0:e190455d7dbb 32 }