hjkj

Dependencies:   TFT-RFID_Finish mbed MFRC522 UniGraphic

Dependents:   TFT-RFID_Finish2

Revision:
10:2985dc4e40a5
Parent:
9:914f2ea246bc
Child:
11:b56e743f7a5d
--- a/main.cpp	Fri Dec 14 20:41:26 2018 +0000
+++ b/main.cpp	Sat Dec 15 09:08:34 2018 +0000
@@ -26,12 +26,7 @@
 int k=0;
 int Pagejawjiw = 0;
 int state = 0;
-int main()
-{   //while(1){
-//    if(Sw[2] == 0){
-//    wait(0.3);
-//    pc.printf("BOOO\n");
-//    }}
+int main(){
     char *StudentID;
     uint8_t UIDCard[4]={};
     pc.printf("starting...\n");
@@ -46,76 +41,34 @@
 
     while(1){  
         if(Pagejawjiw == 0){
-            //if(Sw[0] == 0){
-//            wait(0.3);
-//            pc.printf("BOOO\n");
-//        }
             myLCD.background(backgroundcolor);
             myLCD.foreground(foregroundcolor);
             myLCD.Bitmap(150,45,180,180,data);
             myLCD.fillrect(0,320,500,280,Orange);
             time=t.read_us();
-            for(int i=2; i<200;i++){
+            if(! RfChip.PICC_IsNewCardPresent()){
+                  pc.printf("GOOOOOOOOO\n");
+                  for(int i=200; i<=200;i++){
                     myLCD.locate(i,295);
                     myLCD.set_font((unsigned char*) Arial12x12);
-                    myLCD.printf("Please scan your Student ID card to start.");
-                    if ( ! RfChip.PICC_IsNewCardPresent()){pc.printf("GOOOOOOOOO\n",StudentID);wait_ms(10);continue;}
-                    if ( ! RfChip.PICC_ReadCardSerial()){pc.printf("!!!!!!!!!!!!!!!",StudentID);wait_ms(10);continue;}
-            }
-            for(int i=200; i>=2;i--){
+                    myLCD.printf("Please scan your Student ID card to start.");}
+                  for(int i=200; i>=2;i--){
                     myLCD.locate(i,295);
                     myLCD.set_font((unsigned char*) Arial12x12);
-                    myLCD.printf("Please scan your Student ID card to start.");
-                    if ( ! RfChip.PICC_IsNewCardPresent()){pc.printf("GOOOOOOOOO\n",StudentID);wait_ms(10);continue;}
-                    if ( ! RfChip.PICC_ReadCardSerial()){pc.printf("!!!!!!!!!!!!!!!",StudentID);wait_ms(10);continue;}
-            }
-            if ( ! RfChip.PICC_IsNewCardPresent()){wait_ms(10);continue;}
-            if ( ! RfChip.PICC_ReadCardSerial()){wait_ms(10);continue;}
+                    myLCD.printf("Please scan your Student ID card to start.");}
+                  continue;}
+            if ( ! RfChip.PICC_ReadCardSerial()){pc.printf("!!!!!!!!!!!!!!!");continue;}
             pc.printf("Studen's ID: ");
             for (uint8_t i = 0; i < RfChip.uid.size; i++){UIDCard[i] = RfChip.uid.uidByte[i];}
             if (UIDCard[0]==187 and UIDCard[1]==164 and UIDCard[2]==90 and UIDCard[3]==127){StudentID = "60340500033"; pc.printf("%s\n",StudentID);Pagejawjiw = 1;myLCD.cls();}
             else if (UIDCard[0]==60 and UIDCard[1]==135 and UIDCard[2]==56 and UIDCard[3]==59){StudentID = "60340500066"; pc.printf("%s\n",StudentID);Pagejawjiw = 0;}
             else {StudentID="0"; pc.printf("%s\n",StudentID);}
-//            if (StudentID != "0"){Pagejawjiw = 1;myLCD.cls();}
-//            else {Pagejawjiw = 0;}
             }
         else if (Pagejawjiw == 1) {
-      ///first page///
-        //myLCD.cls();
-//        myLCD.fillrect(0,0,500,50,Orange);
-//        myLCD.rect(155,70,320,120,Orange);
-//        myLCD.rect(155,130,320,180,Orange);
-//        myLCD.rect(155,190,320,240,Orange);
-//        myLCD.rect(155,250,320,300,Orange);
-//        myLCD.set_font((unsigned char*) Arial28x28);
-//        myLCD.locate(160,15);
-//        myLCD.background(Orange);
-//        myLCD.foreground(Black);
-//        myLCD.printf("Select Mode");
-//        myLCD.set_font((unsigned char*) Arial24x23);
-//        myLCD.locate(162,85);
-//        myLCD.background(Yellow);
-//        myLCD.foreground(Green);
-//        myLCD.printf(" Document");
-//        myLCD.locate(187,145);
-//        myLCD.background(White);
-//        myLCD.foreground(Black);
-//        myLCD.printf("ID Card");
-//        myLCD.locate(177,205);
-//        myLCD.background(White);
-//        myLCD.foreground(Black);
-//        myLCD.printf("Financial");
-//        myLCD.locate(202,265);
-//        myLCD.background(White);
-//        myLCD.foreground(Black);
-//        myLCD.printf("Other");
-//        wait(5);
-        //do{
                 if(i == 0 or Sw[2] == 0){
                     i++;
                     switch(i){
                         case 1:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -177,7 +130,6 @@
                             wait(0.3);
                             break;  
                         case 3:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -208,7 +160,6 @@
                             wait(0.3);
                             break; 
                         case 4:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -281,7 +232,6 @@
                             wait(0.3);
                             break; 
                         case 2:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -312,7 +262,6 @@
                             wait(0.3);
                             break;  
                         case 3:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -343,7 +292,6 @@
                             wait(0.3);
                             break; 
                         case 4:
-                            //myLCD.cls();
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.rect(155,70,320,120,Orange);
                             myLCD.rect(155,130,320,180,Orange);
@@ -378,13 +326,10 @@
                 else if(Sw[4] == 0){
                     Pagejawjiw++;
                     wait(0.3);
-                    //break;
                     }
                 }
-            //}
             else if(Pagejawjiw == 2){
                 if(j == 0 or Sw[1] == 0){
-                    //j++;
                     switch(j){
                        case 0:
                             j++;
@@ -407,7 +352,6 @@
                             wait(0.3);
                             break;
                         case 1:
-                            //j++;
                             myLCD.fillrect(0,0,500,50,Orange);
                             myLCD.locate(150,15);
                             myLCD.background(Orange);
@@ -455,34 +399,20 @@
                     Pagejawjiw++;
                     wait(0.3);
                     myLCD.cls();
-                    //break;
                     k=0;
                     }
                 }
             else if(Pagejawjiw == 3){
                 if(k==0 or Sw[1] == 0){
-                //myLCD.cls();
                 myLCD.fillrect(0,0,500,50,Orange);
                 myLCD.locate(150,15);
                 myLCD.background(Orange);
-                //myLCD.set_font((unsigned char*) Arial28x28);
-//                myLCD.printf("Select JorJew");
-//                myLCD.fillrect(40,130,215,230,DarkGrey);
-//                myLCD.fillrect(265,130,440,230,DarkGrey);
-//                myLCD.fillcircle(127,182,40,White);
-//                myLCD.fillcircle(347,182,40,White);
-//                myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//                myLCD.background(White);
-//                myLCD.locate(106,160);
-//                myLCD.printf(" 1");
-//                myLCD.locate(326,160);
-//                myLCD.printf(" 2");
-                myLCD.fillrect(125,90,355,230,Green);  //pop-up
+                myLCD.fillrect(125,90,355,230,Green); 
                 myLCD.set_font((unsigned char*) Arial28x28);
                 myLCD.locate(165,130);
                 myLCD.background(Green);
                 myLCD.foreground(Black);
-                myLCD.printf(" Take out"); //chosen jor
+                myLCD.printf(" Take out"); 
                 myLCD.locate(155,170);
                 myLCD.printf(" JorJew#1/2");
                 myLCD.fillrect(100,250,215,300,Yellow);
@@ -494,39 +424,17 @@
                 myLCD.locate(265,260);
                 myLCD.printf("(C)");
                 k++;
-                //Pagejawjiw++;
                 wait(0.3);
-                //myLCD.cls();
-                //break;
-                //pc.printf("%d",k);
-//                wait(0.3);
-               // switch(k){
-//                case 0:
-//                        if(Sw[0] == 0){
-//                            Pagejawjiw++;
-//                            wait(0.3);
-//                            //myLCD.cls();
-//                            break;
-//                            }
-//                        else if(Sw[2] == 0){
-//                            Pagejawjiw = 2;
-//                            wait(0.3);
-//                            //myLCD.cls();
-//                            break;
-//                    }
                 }
                 else if((Sw[0] == 0)){
                     myLCD.cls();
                     Pagejawjiw++;
                     wait(0.3);
-                    //break;
                 }
                 else if((Sw[2] == 0)){
-                    //myLCD.cls();
                     Pagejawjiw--;
                     wait(0.3);
                     j = 0;
-                    //break;
                 }
                 }
             else if(Pagejawjiw == 4){
@@ -550,164 +458,6 @@
                 }
                 wait(5);
                 myLCD.cls();
-//                while(Sw[5] == 0){
-//                    Pagejawjiw = 1;
-//                    wait(0.3);
-//                    }
               }
-//            }
-//            else {Pagejawjiw = 1;}
-                
-        
-        //point//
-        //myLCD.background(Yellow);
-//        myLCD.foreground(White);
-        
-        //second page//
-        //do{
-//            if(Sw[4] == 0){
-//                myLCD.cls();
-//                if(j == 0 or Sw[1] == 0 or Sw[3] == 0){
-//                    j++;
-//                    switch(j){
-//                        case 0:
-//                            j++;
-//                            myLCD.fillrect(0,0,500,50,Orange);
-//                            myLCD.locate(150,15);
-//                            myLCD.background(Orange);
-//                            myLCD.set_font((unsigned char*) Arial28x28);
-//                            myLCD.printf("Select JorJew");
-//                            myLCD.fillrect(40,130,215,230,DarkGrey);
-//                            myLCD.fillrect(265,130,440,230,DarkGrey);
-//                            myLCD.fillcircle(127,182,40,Yellow);
-//                            myLCD.fillcircle(347,182,40,White);
-//                            myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//                            myLCD.background(White);
-//                            myLCD.locate(106,160);
-//                            myLCD.printf(" 1");
-//                            myLCD.locate(326,160);
-//                            myLCD.printf(" 2");
-//                            wait(0.3);
-//                            break;
-//                        case 1:
-//                            j--;
-//                            myLCD.fillrect(0,0,500,50,Orange);
-//                            myLCD.locate(150,15);
-//                            myLCD.background(Orange);
-//                            myLCD.set_font((unsigned char*) Arial28x28);
-//                            myLCD.printf("Select JorJew");
-//                            myLCD.fillrect(40,130,215,230,DarkGrey);
-//                            myLCD.fillrect(265,130,440,230,DarkGrey);
-//                            myLCD.fillcircle(127,182,40,White);
-//                            myLCD.fillcircle(347,182,40,Yellow);
-//                            myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//                            myLCD.background(White);
-//                            myLCD.locate(106,160);
-//                            myLCD.printf(" 1");
-//                            myLCD.locate(326,160);
-//                            myLCD.printf(" 2");
-//                            wait(0.3);
-//                            break;
-//                        }
-//                    }
-//                else if(Sw[4] == 0){
-//                    State = 1;
-//                    break;
-//                    }
-//                }
-//            }while(State == 1);
-//                myLCD.cls();
-//                myLCD.fillrect(0,0,500,50,Orange);
-//                myLCD.locate(150,15);
-//                myLCD.background(Orange);
-//                myLCD.set_font((unsigned char*) Arial28x28);
-//                myLCD.printf("Select JorJew");
-//                myLCD.fillrect(40,130,215,230,DarkGrey);
-//                myLCD.fillrect(265,130,440,230,DarkGrey);
-//                myLCD.fillcircle(127,182,40,White);
-//                myLCD.fillcircle(347,182,40,White);
-//                myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//                myLCD.background(White);
-//                myLCD.locate(106,160);
-//                myLCD.printf(" 1");
-//                myLCD.locate(326,160);
-//                myLCD.printf(" 2");
-//                myLCD.fillrect(125,90,355,280,Green);  //pop-up
-//                myLCD.set_font((unsigned char*) Arial28x28);
-//                myLCD.locate(165,140);
-//                myLCD.background(Green);
-//                myLCD.foreground(Black);
-//                myLCD.printf(" Take out"); //chosen jor
-//                myLCD.locate(155,180);
-//                myLCD.printf(" JorJew#1/2");
-//                wait(0.3);
-        //myLCD.cls();
-//        myLCD.fillrect(0,0,500,50,Orange);
-//        myLCD.locate(150,15);
-//        myLCD.background(Orange);
-//        myLCD.set_font((unsigned char*) Arial28x28);
-//        myLCD.printf("Select JorJew");
-//        myLCD.fillrect(40,130,215,230,DarkGrey);
-//        myLCD.fillrect(265,130,440,230,DarkGrey);
-//        myLCD.fillcircle(127,182,40,White);
-//        myLCD.fillcircle(347,182,40,White);
-//        myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//        myLCD.background(White);
-//        myLCD.locate(106,160);
-//        myLCD.printf(" 1");
-//        myLCD.locate(326,160);
-//        myLCD.printf(" 2");
-//        wait(5);
-        //point//
-        //myLCD.background(Yellow);
-        //myLCD.foreground(White);
-        
-        //third page//
-        
-        //myLCD.cls();
-//        myLCD.fillrect(0,0,500,50,Orange);
-//        myLCD.locate(150,15);
-//        myLCD.background(Orange);
-//        myLCD.set_font((unsigned char*) Arial28x28);
-//        myLCD.printf("Select JorJew");
-//        myLCD.fillrect(40,130,215,230,DarkGrey);
-//        myLCD.fillrect(265,130,440,230,DarkGrey);
-//        myLCD.fillcircle(127,182,40,White);
-//        myLCD.fillcircle(347,182,40,White);
-//        myLCD.set_font((unsigned char*) Arial43x48_numb, 46, 58, false);
-//        myLCD.background(White);
-//        myLCD.locate(106,160);
-//        myLCD.printf(" 1");
-//        myLCD.locate(326,160);
-//        myLCD.printf(" 2");
-//        myLCD.fillrect(125,90,355,280,Green);  //pop-up
-//        myLCD.set_font((unsigned char*) Arial28x28);
-//        myLCD.locate(165,140);
-//        myLCD.background(Green);
-//        myLCD.foreground(Black);
-//        myLCD.printf(" Take out"); //chosen jor
-//        myLCD.locate(155,180);
-//        myLCD.printf(" JorJew#1/2");
-//        wait(5);
-
-//        //forth page//        
-//        
-//        myLCD.cls();
-//        myLCD.background(backgroundcolor);
-//        myLCD.foreground(foregroundcolor);
-//        myLCD.Bitmap(150,45,180,180,data);
-//        myLCD.fillrect(0,320,500,280,Orange);
-//        time=t.read_us();
-//        for(int i=2; i<350;i++){
-//                myLCD.locate(i,295);
-//                myLCD.set_font((unsigned char*) Arial12x12);
-//                myLCD.printf("Love , Thank you");
-//        }
-//        for(int i=350; i>=2;i--){
-//                myLCD.locate(i,295);
-//                myLCD.set_font((unsigned char*) Arial12x12);
-//                myLCD.printf("Love , Thank you");
-//        }
-//      }
-      } //} 
+      }
 }
\ No newline at end of file