section B 57340500043 57340500046

Dependencies:   Motor PID eeprom mbed

Fork of Tanginamo by Digital B14

Revision:
4:6e29193d7f95
Parent:
3:6e2ad66e591c
Child:
5:4168693bfb80
--- a/main.cpp	Mon Dec 07 20:26:24 2015 +0000
+++ b/main.cpp	Mon Dec 07 21:32:46 2015 +0000
@@ -131,6 +131,7 @@
             PC.printf("Menu\n");
             PC.printf("1.Mode Write Or Read  \n");
             PC.printf("2.Mode POP\n");
+            PC.printf("3.Mode Set Encode\n");
             state_show =1;
         }
         if(PC.readable()) {
@@ -158,7 +159,6 @@
 
                                 case 'a':
                                     StartWriteRead(1);
-                                    PC.printf("Press A\n");
                                     break;
 
                                 case 's':
@@ -227,14 +227,58 @@
                     } while(state_exit ==0);
                     PC.printf("\n\n");
                     break;
+                    
+                    case '3':
+                    do{
+                        if(state_menu == 0) {
+                            PC.printf("Mode SetPoint\n");
+                            PC.printf("z.Mode SetPoint \n");
+                            PC.printf("x.Stop \n");
+                            state_menu = 1;
+                        }
+                        if(PC.readable()) {
+                            data = PC.getc();
+                            PC.printf("\n");
+                            state_menu=0;
+
+                            switch(data) {
+
+                                case 'z':
+                                    PC.printf("Mode SetPoint\n");
+                                    PC.printf("In Put Your Point 0-128 and spacebar\n");
+                                    PC.scanf(" %d",&SetPoint);
+                                    PC.printf("%d",SetPoint);
+                                    while(SetPoint>128)
+                                        {
+                                        PC.printf("Your Number ERROR Plz Input 0-128 and spacebar\n");
+                                        PC.scanf("%d",&SetPoint);
+                                        }
+                                    PC.printf("SETPOINT = %d",SetPoint);
+                                    break;
+
+                                case 'x':
+                                    state_exit = 1;
+                                    break;
+
+                                default:
+                                    PC.printf("plz select z or x\n");
+                                    PC.printf("\n\n");
+                                    break;
+
+                            }
+                        }
 
 
+
+                    } while(state_exit ==0);
+                    PC.printf("\n\n");
+                    break;
                 case 0x00:
 
                     break;
 
                 default:
-                    PC.printf("plz select 1 or 2 only\n");
+                    PC.printf("plz select 1 or 2 or 3 only\n");
                     PC.printf("\n\n");
                     break;
             }