Nucleo RFID EM18 125KHz low frequency

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
shivanandgowdakr
Date:
Thu Jul 12 06:57:41 2018 +0000
Child:
1:3781e9bf2c47
Commit message:
EM18 Rfid Nucleo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Jul 12 06:57:41 2018 +0000
@@ -0,0 +1,39 @@
+#include "mbed.h"
+
+
+
+
+// initialize the library with the numbers of the interface pins
+DigitalOut led(LED1);
+Serial EM18Rfid(PC_12,PD_2);
+
+int count = 0;          //integer for storing character of ID
+
+char input[12];//memory for storing 12 characters of ID
+
+int main()
+{
+ EM18Rfid.baud(9600); //Baud Rate 9600                             
+
+        while(true)
+        
+        {    
+        
+        while(EM18Rfid.readable() && count < 12)          // Read 12 characters and store them in input array
+            
+            {
+                input[count] = EM18Rfid.getc();
+                count++;
+                    if (count==12)
+                    {        
+                    led=1;
+                    input[count]='\0';
+                    printf("Read Tag Id is : %s\r\n",input);  
+                    count = 0;// once 12 characters are read get to start and wait for 1 second  before reading next ID
+                    wait(1);
+                    led=0;                
+                    }
+            }
+        
+        } 
+}           
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Jul 12 06:57:41 2018 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/a7c7b631e539
\ No newline at end of file