ボタンを押すと、 バッテリ更新を停止し、 他のボタンもロックさせる

Dependencies:   RemoteIR TextLCD

Revision:
51:622df065f7ff
Parent:
50:6c25bf1c39d7
--- a/main.cpp	Thu Aug 27 08:20:14 2020 +0000
+++ b/main.cpp	Tue Sep 01 05:36:30 2020 +0000
@@ -48,8 +48,8 @@
 DigitalIn   ss5(p12);       // ライントレースセンサ(右)
 RawSerial   esp(p13, p14);  // Wi-Fiモジュール(tx, rx)
 AnalogIn    battery(p15);   // 電池残量読み取り(Max 3.3V)
-PwmOut      motorR2(p21);   // 右モーター後退
-PwmOut      motorR1(p22);   // 右モーター前進
+PwmOut      motorR2(p22);   // 右モーター後退
+PwmOut      motorR1(p21);   // 右モーター前進
 PwmOut      motorL2(p23);   // 左モーター後退
 PwmOut      motorL1(p24);   // 左モーター前進
 PwmOut      servo(p25);     // サーボ
@@ -1153,9 +1153,9 @@
 //strcpy(webbuff, "<script language=\"javascript\" type=\"text/javascript\">");
 //strcat(webbuff, "document.getElementById('leftms').value=\"100\";");
 
-sprintf(battery_ch,"%d",b);
+//sprintf(battery_ch,"%d",b);
 //sprintf(battery_ch,"%d",30);
-strcpy(webbuff, battery_ch);
+strcpy(webbuff, "response ok");
 
 //strcpy(webbuff, "document.getElementById('leftms').value=\"100\";");
 
@@ -1247,7 +1247,7 @@
              pc.printf("\r\n++++++++++++++mode = LEFT++++++++++++++\r\n");
              sendpage2();
             }
-            
+            /*
               if( strstr(webdata, "GO") != NULL ) {
                                      sendpage3();
 
@@ -1264,7 +1264,7 @@
                click_flag = 0;
 //0826
         }  
-        
+        */
         
         if( strstr(webdata, "Normal") != NULL ) {
             pc.printf("++++++++++++++++++Normal++++++++++++++++++++");
@@ -1287,7 +1287,7 @@
         }else{
             beforeMode = mode;
         }
-  /*      
+        
         if( strstr(webdata, "GO") != NULL ) {
                                      sendpage3();
 
@@ -1304,8 +1304,10 @@
                click_flag = 0;
 //0826
         }
-*/
+
         if( strstr(webdata, "LEFT") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++左折+++++++++++++++++++++\r\n");
             //delete avoi_thread;     //障害物回避スレッド停止
             //delete trace_thread;    //ライントレーススレッド停止
@@ -1315,6 +1317,8 @@
         }
  
         if( strstr(webdata, "STOP") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++停止+++++++++++++++++++++\r\n");
             //delete avoi_thread;     //障害物回避スレッド停止
             //delete trace_thread;    //ライントレーススレッド停止
@@ -1324,6 +1328,8 @@
         }
  
         if( strstr(webdata, "RIGHT") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++右折+++++++++++++++++++++\r\n");
             //delete avoi_thread;     //障害物回避スレッド停止
             //delete trace_thread;    //ライントレーススレッド停止
@@ -1333,6 +1339,8 @@
         }
  
         if( strstr(webdata, "BACK") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++後進+++++++++++++++++++++\r\n");
             //delete avoi_thread;     //障害物回避スレッド停止
             //delete trace_thread;    //ライントレーススレッド停止
@@ -1343,6 +1351,8 @@
         pc.printf("+++++++++++++++++succed+++++++++++++++++++++");
  
         if( strstr(webdata, "AVOIDANCE") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++AVOIDANCE+++++++++++++++++++++");
             if(avoi_thread->get_state() == Thread::Deleted) {
                 delete avoi_thread;     //障害物回避スレッド停止
@@ -1354,6 +1364,8 @@
             display();          // ディスプレイ表示
         }
         if( strstr(webdata, "LINE_TRACE") != NULL ) {
+                                                 sendpage3();
+
             pc.printf("+++++++++++++++++LINET RACE+++++++++++++++++++++");
             pc.printf("mode = LINE_TRACE\r\n");
             if(trace_thread->get_state() == Thread::Deleted) {
@@ -1486,6 +1498,8 @@
     /* 初期設定 */
     wifi_thread = new Thread(wifi);
     wifi_thread -> set_priority(osPriorityHigh);
+  // pc.printf("\n++++++++++ begin ++++++++++\r\n");
+  //setup();
     avoi_thread = new Thread(avoidance);
     avoi_thread->terminate();
     trace_thread = new Thread(trace);