WRS2019

Dependencies:   mbed BufferedSerial PID2 JY901 ros_lib_kinetic TextLCD i2cmaster Make_Sequencer_3

Revision:
3:4ac32aff309c
Parent:
2:83fa142c5bcc
Child:
4:25ab7216447f
--- a/main.cpp	Tue Dec 17 07:23:55 2019 +0000
+++ b/main.cpp	Tue Dec 17 12:42:15 2019 +0000
@@ -131,6 +131,12 @@
     int array[SIZE] = {};
     FILE *fp = fopen( "/local/guide1.txt", "r");
     MakeSequencer code(fp);
+    printf("size:%d\r\n", code.getGcodeSize());
+    for(int i = 0; i < code.getGcodeSize(); i++)
+    {
+        code.getGcode(i,sizeof(array)/sizeof(int),array);
+        printf("%d, %d, %d\r\n", array[0], array[1], i);
+    }
     
     int row = 1;
     float v[4] = {};
@@ -195,11 +201,28 @@
             
             // Gコードを次の行に
             row++;
-            if(row > code.getGcodeSize())
+            if(row >= code.getGcodeSize())
             {
                 row = 0;
+                coastAllMotor();
+                PC.printf("All task Clear\r\n");
+                PC.printf("\r\nI'm ready to start. Press Key 'a'.\r\n");
+                char input_character = 0;
+                while(input_character != 'a')
+                {
+                    if(PC.readable() > 0)
+                    {
+                        input_character = PC.getc();   
+                    }
+                }
             }
             
+            jy901.reset();
+            v[0] = 0;
+            v[1] = 0;
+            v[2] = 0;
+            v[3] = 0;
+            
             // 目標位置把握
             code.getGcode(row, ArraySize(array), array);
             x_desire = array[0];
@@ -247,7 +270,7 @@
     //PC.attach(serialRead);
     jy901.calibrateAll(5000);
     //controlFromWASD();
-    PC.printf("\r\nI'm ready to start. Press Enter\r\n");
+    PC.printf("\r\nI'm ready to start. Press Key 'a'.\r\n");
     //bool startable = false;
     char input_character = 0;
     while(input_character != 'a')