Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. #include <SPI.h>
  2. #include <RFID.h>
  3. #include <Keyboard.h>
  4.  
  5. #define SS_PIN 7
  6. #define RST_PIN 5
  7.  
  8. RFID rfid(SS_PIN, RST_PIN);
  9. char Enter = KEY_RETURN;
  10. int serNum[5];
  11. int kartu[5] = {75, 185, 161, 13, 94};
  12. int card[5] = {193, 165, 118, 137, 155};//write your RFID card number here
  13.  
  14. void setup()
  15. {
  16. Serial.begin(9600);
  17. SPI.begin();
  18. rfid.init();
  19.  
  20. }
  21.  
  22. void loop()
  23. {
  24. if (rfid.isCard())
  25. {
  26. Serial.println("card available");
  27. if (rfid.readCardSerial())
  28. {
  29.  
  30. for (int x = 0; x < 10; x++)
  31. {
  32. for (int i = 0; i < sizeof(rfid.serNum); i++ )
  33. {
  34. // Serial.println(rfid.serNum[i]); //to serial print the scanned RFID card number, note it down and change it on line 10
  35. if (rfid.serNum[i] == kartu[i])
  36. {
  37. Keyboard.press(KEY_LEFT_GUI); //Press the left windows key.
  38. Keyboard.press('l');
  39. Keyboard.releaseAll(); //Release all keys.
  40. Keyboard.press(Enter);
  41. Keyboard.release(Enter); //Press the Enter key.
  42. Keyboard.releaseAll();
  43. Keyboard.print("pass"); // Change this value to your Windows PIN/Password.
  44. Keyboard.releaseAll();
  45. delay(100);
  46. Keyboard.press(Enter);
  47. Keyboard.releaseAll();
  48. }
  49. else if (rfid.serNum[i] == card[i])
  50. {
  51. Keyboard.print("pass"); // Change this value to your Windows PIN/Password.
  52. Keyboard.releaseAll();
  53. delay(100);
  54. Keyboard.press(Enter);
  55. Keyboard.releaseAll();
  56. }else
  57. {
  58. return;
  59. }
  60. }
  61. }
  62. }
  63. }
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement