hjkj
Dependencies: TFT-RFID_Finish mbed MFRC522 UniGraphic
Revision 11:b56e743f7a5d, committed 2018-12-18
- Comitter:
- cakejohnn
- Date:
- Tue Dec 18 22:26:40 2018 +0000
- Parent:
- 10:2985dc4e40a5
- Commit message:
- ss
Changed in this revision
| TFT-RFID_Finish3.lib | Show annotated file Show diff for this revision Revisions of this file |
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/TFT-RFID_Finish3.lib Tue Dec 18 22:26:40 2018 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/teams/Jawjiw/code/TFT-RFID_Finish/#2985dc4e40a5
--- a/main.cpp Sat Dec 15 09:08:34 2018 +0000
+++ b/main.cpp Tue Dec 18 22:26:40 2018 +0000
@@ -12,6 +12,7 @@
#include "MFRC522.h"
#define MF_RESET PC_6
Serial pc(SERIAL_TX, SERIAL_RX);
+Serial esp(PA_15,PB_7);
MFRC522 RfChip (SPI_MOSI, SPI_MISO, SPI_SCK, SPI_CS, MF_RESET);
PinName buspins[] = { PA_9, PC_7, PA_10, PB_3, PB_5, PB_4, PB_10, PA_8 };
TFT_MIPI myLCD(BUS_8, buspins, A3, A4, A2, A1, A0, "myLCD");
@@ -21,17 +22,19 @@
unsigned short backgroundcolor=Orange;
unsigned short foregroundcolor=Black;
char orient=1;
+char b[] = " ";
int i=0;
int j=0;
int k=0;
int Pagejawjiw = 0;
int state = 0;
int main(){
+ pc.baud(9600);
+ esp.baud(9600);
char *StudentID;
uint8_t UIDCard[4]={};
pc.printf("starting...\n");
RfChip.PCD_Init();
-
myLCD.set_orientation(orient);
int time;
t.start();
@@ -60,8 +63,20 @@
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;}
+ 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();
+ char b[] = "X";
+ esp.putc(b[0]);
+ char id = esp.putc(b[0]);
+ pc.printf("id %c\n",id);
+ }
+ 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 = 1;
+ char b[] = "Y";
+ esp.putc(b[0]);
+ char id = esp.putc(b[0]);
+ pc.printf("id %c\n",id);
+ }
else {StudentID="0"; pc.printf("%s\n",StudentID);}
}
else if (Pagejawjiw == 1) {
@@ -69,6 +84,11 @@
i++;
switch(i){
case 1:
+ char a[] = "1";
+ esp.putc(a[0]);
+ char ty = esp.putc(a[0]);
+ pc.printf("type %c\n",ty);
+ pc.printf("A \n");
myLCD.fillrect(0,0,500,50,Orange);
myLCD.rect(155,70,320,120,Orange);
myLCD.rect(155,130,320,180,Orange);
@@ -100,6 +120,11 @@
break;
case 2:
//myLCD.cls();
+ char b[] = "2";
+ esp.putc(b[0]);
+ char ty2 = esp.putc(b[0]);
+ pc.printf("type %c\n",ty2);
+ pc.printf("B \n");
myLCD.fillrect(0,0,500,50,Orange);
myLCD.rect(155,70,320,120,Orange);
myLCD.rect(155,130,320,180,Orange);
@@ -130,6 +155,12 @@
wait(0.3);
break;
case 3:
+
+ char c[] = "3";
+ esp.putc(c[0]);
+ char ty3 = esp.putc(c[0]);
+ pc.printf("type %c\n",ty3);
+ pc.printf("C \n");
myLCD.fillrect(0,0,500,50,Orange);
myLCD.rect(155,70,320,120,Orange);
myLCD.rect(155,130,320,180,Orange);
@@ -160,6 +191,11 @@
wait(0.3);
break;
case 4:
+ char d[] = "4";
+ esp.putc(d[0]);
+ char ty4 = esp.putc(d[0]);
+ pc.printf("type %c\n",ty4);
+ pc.printf("D \n");
myLCD.fillrect(0,0,500,50,Orange);
myLCD.rect(155,70,320,120,Orange);
myLCD.rect(155,130,320,180,Orange);
@@ -191,6 +227,10 @@
break;
case 5:
i=0;
+// int typeA = 0;
+// int typeB = 0;
+// int typeC = 0;
+// int typeD = 0;
break;
}
}
@@ -325,7 +365,7 @@
}
else if(Sw[4] == 0){
Pagejawjiw++;
- wait(0.3);
+ wait(0.3);
}
}
else if(Pagejawjiw == 2){