Nucleo RFID EM18 125KHz low frequency
Diff: main.cpp
- Revision:
- 0:1a3020ba8001
- Child:
- 1:3781e9bf2c47
--- /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