Dependencies:   mbed

Revision:
6:f692a3954e6a
Parent:
5:32a200d7c6bc
Child:
7:575555ac3120
--- a/main.cpp	Mon Oct 25 09:04:47 2021 +0000
+++ b/main.cpp	Mon Oct 25 10:01:09 2021 +0000
@@ -1,31 +1,24 @@
 #include "mbed.h"
 #include "ATP3011.h"
-
+ 
 Serial pc(SERIAL_TX, SERIAL_RX);
 ATP3011 talk(D4,D5); // I2C sda scl
-
-
-
-
+ 
+ 
+ 
+ 
 int main(){
                int timeout_ms=500;
-               char mess[100];
                int flag;
-               int i;
-               Timer ft;//flag timer
-               ft.start();             
+               char mess[100];            
                if(talk.IsActive(timeout_ms)==true){
                    pc.printf("Active\n");
-                   do{
-                       if(ft.read()<=5){
-                           pc.printf("flag=");
-                           pc.scanf("%d",&flag);//なんか送るなら1を入力
-                           wait(10);
-                           }else{
+                   wait(5)
+                   if(pc.readable()){
+                       flag=1;
+                       }else{
                            flag=0;
                            }
-                    }while(ft.read()<=13);
-                ft.reset();
                 if(flag==0){
                        talk.Synthe("purissetommese-ji,,konnichiwa.");
                        }else if(flag==1){
@@ -38,5 +31,4 @@
                    }
                    
          return 0;
-      }
-      
\ No newline at end of file
+      }
\ No newline at end of file