Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp
00001 00002 #include "mbed.h" 00003 00004 00005 Serial RfidUHF(PC_12,PD_2); 00006 00007 00008 unsigned char StopReadCode[5] = {0xa0,0x03,0xa8,0x00,0xb5};//Stop reading the label code 00009 unsigned char ResetCode[5]={0xa0,0x03,0x65,0x00,0xf8};//Reset code 00010 unsigned char StopReadCodeCB[6]={0xe0,0x04,0xa8,0x00,0x00,0x74};//Stop reading code success and return the value 00011 unsigned char ResetCodeCB[6]={0xe4,0x04,0x65,0x00,0x00,0xb3};//Reset code success and return the value 00012 unsigned char data[6]={}; 00013 00014 int main() 00015 { 00016 int i; 00017 int n=1; 00018 00019 00020 while(true) 00021 { 00022 00023 wait(2.0); 00024 while(n) 00025 { 00026 for(i=0; i<5;i++) 00027 RfidUHF.putc(StopReadCode[i]); 00028 wait(0.2); 00029 if(RfidUHF.readable()) 00030 { 00031 for(i=0;i<6;i++) 00032 { 00033 data[i]=RfidUHF.getc(); 00034 wait_ms(1); 00035 } 00036 for(i=0;i<6;i++) 00037 { 00038 if(data[i]==StopReadCodeCB[i]) 00039 n=0; 00040 else 00041 n=1; 00042 } 00043 } 00044 wait(0.5); 00045 } 00046 00047 n=1; 00048 00049 while(n) 00050 { 00051 for(i=0; i<5;i++) 00052 RfidUHF.putc(ResetCode[i]); 00053 00054 wait(0.2); 00055 if(RfidUHF.readable()) 00056 { 00057 for(i=0;i<6;i++) 00058 { 00059 data[i]=RfidUHF.getc(); 00060 wait(1); 00061 } 00062 for(i=0;i<6;i++) 00063 { 00064 if(data[i]==ResetCodeCB[i]) 00065 n=0; 00066 else 00067 n=1; 00068 } 00069 } 00070 wait(0.5); 00071 } 00072 } 00073 }
Generated on Sat Jul 23 2022 13:06:20 by
1.7.2