test

Dependents:   LSI_Compass loop_test CanSat-C_test test

Revision:
0:e190455d7dbb
Child:
1:fe313ebd4f3b
diff -r 000000000000 -r e190455d7dbb speak.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/speak.h	Wed Oct 27 10:15:25 2021 +0000
@@ -0,0 +1,28 @@
+#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("\n\rpreset_message speak");
+                           talk.Synthe("purissetommese-ji,,konnichiwa.");
+                           }
+                   }else{
+                       pc.printf("Not Active\n");
+                   }
+}
\ No newline at end of file