test

Dependents:   LSI_Compass loop_test CanSat-C_test test

Committer:
ushiroji
Date:
Thu Oct 28 09:55:12 2021 +0000
Revision:
2:6eb2b256a28a
Parent:
0:e190455d7dbb
Child:
3:395d8e8f9051
Child:
4:6dd04e220a4c
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 0:e190455d7dbb 7 void speak(){
ushiroji 0:e190455d7dbb 8 int timeout_ms=500;
ushiroji 0:e190455d7dbb 9 char mess[100];
ushiroji 0:e190455d7dbb 10 if(talk.IsActive(timeout_ms)==true){
ushiroji 0:e190455d7dbb 11 pc.printf("Active\n\rflag=");
ushiroji 0:e190455d7dbb 12 wait(3);
ushiroji 0:e190455d7dbb 13 if(pc.readable()){
ushiroji 0:e190455d7dbb 14 pc.printf("\n\rmessage=");
ushiroji 0:e190455d7dbb 15 int i=0;
ushiroji 0:e190455d7dbb 16 do{
ushiroji 0:e190455d7dbb 17 mess[i++]= pc.getc();
ushiroji 0:e190455d7dbb 18 }while(mess[i-1]!= 0x0d && i<99);
ushiroji 0:e190455d7dbb 19 //pc.scanf("%s",mess);
ushiroji 0:e190455d7dbb 20 talk.Synthe(mess);
ushiroji 0:e190455d7dbb 21 }else{
ushiroji 2:6eb2b256a28a 22 pc.printf("preset_message speak\r\n");
ushiroji 0:e190455d7dbb 23 talk.Synthe("purissetommese-ji,,konnichiwa.");
ushiroji 0:e190455d7dbb 24 }
ushiroji 0:e190455d7dbb 25 }else{
ushiroji 0:e190455d7dbb 26 pc.printf("Not Active\n");
ushiroji 0:e190455d7dbb 27 }
ushiroji 0:e190455d7dbb 28 }