Advertisement
Guest User

Untitled

a guest
Dec 1st, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. /*the following code is to print the RFID value of the card.
  2. we have used the Arduino Mega and put the RFID reader Tx pin in Rx1 */
  3. #include <SoftwareSerial.h>
  4.  
  5. // The following is the card no. for 3 cards. You will be provided these numbers.
  6. String c1="29003359BBF8";
  7. String c2="29003358A0E2";
  8. String c3="2900336893E1";
  9.  
  10. String a="";
  11. String s="";
  12. void setup()
  13. {
  14. Serial.begin(9600);
  15. Serial1.begin(9600);
  16. }
  17. void loop()
  18. {
  19. if(Serial1.available())
  20. a=a+(char)Serial1.read();
  21. s=a;
  22.  
  23. if(s.equalsIgnoreCase(c1))
  24. Serial.println(s+" p1");
  25. else if(s.equalsIgnoreCase(c2))
  26. Serial.println(s+" p2");
  27. else if(s.equalsIgnoreCase(c3))
  28. Serial.println(s+" p3");
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement