Advertisement
Double_G

ID12 Innovation

Feb 4th, 2018
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.71 KB | None | 0 0
  1. #include <SoftwareSerial.h> // Dependency of ID20Reader. Must include in main file
  2.                             // Due to Arduino software limitations.
  3. #include <ID20Reader.h>
  4.  
  5. int rx_pin = 0; //Data input pin
  6. int tx_pin = 8; //Unused, but must be defined. (Nothing is sent from the Arduino to the reader.)
  7.  
  8. ID20Reader rfid(rx_pin, tx_pin); //Create an instance of ID20Reader.
  9.  
  10. void setup() {
  11.   Serial.begin(9600);
  12.   Serial.println("RFID Reader - Swipe a card ~~~~~");
  13. }
  14.  
  15. void loop() {
  16.   rfid.read(); //Receive a tag from the reader if available
  17.  
  18.   if(rfid.available()) //a tag has been read
  19.   {
  20.     String code = rfid.get(); //Get the tag
  21.     Serial.println(code); //Print the tag to the serial monitor
  22.   }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement