ft. button press reset

Dependencies:   mbed

Fork of BeaconDemo_RobotCodeNew by James O'Keeffe

Revision:
20:fe7eb85cf3a1
Parent:
19:b5788427db67
Child:
21:efe191c96cbb
--- a/main.cpp	Wed Mar 01 15:23:47 2017 +0000
+++ b/main.cpp	Thu Mar 02 13:54:12 2017 +0000
@@ -78,7 +78,7 @@
     update_display();
     if(recharging_state == 0) {
         // remove after testing
-        main_program_state = 8;
+        //main_program_state = 8;
         switch(main_program_state) {
             case 0: //Case 0 is the initial program: turn to face beacon
                 if(step_cycle == 0) {
@@ -240,24 +240,48 @@
     display.write_string(buffer);
     
     //"A" = 0x41
-    if(buffer[0] == 0x41){
+    if(buffer[0] == 'A'){
 /*        display.clear_display();
         display.set_position(0,0);
         display.write_string("Gotcha!");*/
         
-        set_program(1); // Head to beacon
+        //set_program(255); // STOP
+        main_program_state = 255;
     }
     //"B" = 0x42
-    else if(buffer[0] == 0x42){
-        set_program(2); // Head inverse to beacon
+    else if(buffer[0] == 'B'){
+        //set_program(1); // Head to beacon
+        main_program_state = 1;
         }
     //"C" = 0x43
-    else if(buffer[0] == 0x43){
-        set_program(5); // Find space
+    else if(buffer[0] == 'C'){
+        //set_program(2); // Head to beacon + 180
+        main_program_state = 2;
         }
     //"D" = 0x44
-    else if(buffer[0] == 0x44){
-        set_program(6); // Clustering
+    else if(buffer[0] == 'D'){
+        //set_program(8); // Flocking
+        main_program_state = 8;
+        }
+    else if(buffer[0] == 'E'){
+        //set_program(4); // Random Walk
+        main_program_state = 4;
+        }
+    else if(buffer[0] == 'F'){
+        //set_program(6); // Aggregation
+        main_program_state = 6;
+        }
+    else if(buffer[0] == 'G'){
+        //set_program(5); // Find Space
+        main_program_state = 5;
+        }
+    else if(buffer[0] == 'H'){
+        //set_program(6); // Clustering
+        main_program_state = 6;
+        }
+    else if(buffer[0] == 'I'){
+        //set_program(7); // Tag
+        main_program_state = 7;
         }
     else
     {