florian jehannin
/
RFID_2
RFID code
Revision 1:8ce51b11d567, committed 2017-01-04
- Comitter:
- florianjehannin
- Date:
- Wed Jan 04 13:50:34 2017 +0000
- Parent:
- 0:4dae10bd57f2
- Commit message:
- bref
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 4dae10bd57f2 -r 8ce51b11d567 main.cpp --- a/main.cpp Fri Dec 30 14:04:22 2016 +0000 +++ b/main.cpp Wed Jan 04 13:50:34 2017 +0000 @@ -2,7 +2,6 @@ Serial rfid(PC_12, PD_2); //tx, rx Serial pc(PC_10, PC_11); - int main() { rfid.baud(9600);//RFID reader operates at 9600 baud @@ -10,19 +9,27 @@ pc.format(8,Serial::None,1); //format(bits,SerialBase,stop_bits) int i; - char RFID_read[10]; + int RFID_read[15]; char *RFID_bon = "dc64850d3"; - + int RFID; + char s[50]; pc.printf("\n\r START \n\r"); while (1) { - pc.printf("RFID_read1 : "); + RFID=0; + pc.printf("RFID_read1 : \r\n"); for(i=0;i<5;i++) - { RFID_read[i]=rfid.getc(); - pc.printf("'%c'", RFID_read[i]); - } - + + // sprintf(s,"hello=%d%d%d%d%d",RFID_read[0],RFID_read[1],RFID_read[2],RFID_read[3],RFID_read[4]); + // pc.printf("%s \r\n",s); //écrire sur pc + // int num = atoi(s); + // pc.printf("%d \r\n",num); //écrire sur pc + + for(i=0;i<5;i++) + RFID=RFID+RFID_read[i]; + pc.printf("%d ", RFID); + } } \ No newline at end of file