Hello, in advance I bring apologies for use of the translator when writing post. Problem in the following, the other day I received the RFID module which name it is designated in the subject name, I downloaded library, but in examples there is no sketch for record of tags, look for such code some days, but unsuccessfully, I ask if someone has a sketch to lay out a code.
As faced a problem of transfer of system of calculation, it is necessary to remove a code in a denary format, but instead the code from different tags is displayed in a format from 12 to 15 figures.
My sketch assumes joint connection of lcd, the ds1307 module, a buzzer and actually rfid.
To a post I attach a code, I hope for the help.
Some comments to a code are written in Russian for convenience, but, I hope, it won't prevent you.
I apologize if created a subject in the improper section.
/*?????????? ??????????*/
#include <WProgram.h>
#include <Wire.h>
#include <DS1307.h>
#include <RFID.h>
#include <SPI.h>
#include <LiquidCrystal.h>
#define SS_PIN 2
#define RST_PIN 1
RFID rfid(SS_PIN, RST_PIN);
int buzzPin = 3;
// Setup variables:
int serNum0;
int serNum1;
int serNum2;
int serNum3;
int serNum4;
int i;
/*?????? ???????*/
LiquidCrystal lcd(8, 9, 4, 5, 6, 7);
/*?????????????*/
void setup(){
lcd.begin(16, 2); //??????? 16?2
SPI.begin();
rfid.init();
lcd.setCursor(3, 0); //?????????? 3 ?????? 0 ??????
lcd.print("Wellcome..."); // ??????? ??????? ???????? ARDUINO-RTC
lcd.setCursor(2, 1); //?????????? 5 ?????? 1 ??????
lcd.print("Arduino-Clock"); // ??????? ??????? ???????? DS-1307
//delay(5000); // ?????????? ???????? 5 ??????
lcd.clear(); // ??????? ???????
/*
RTC.stop();
RTC.set(DS1307_SEC,00); //?????????? ???????
RTC.set(DS1307_MIN,21); //?????????? ??????
RTC.set(DS1307_HR,04); //?????????? ????
RTC.set(DS1307_DOW,07); //?????????? ???? ??????
RTC.set(DS1307_DATE,25); //?????????? ????
RTC.set(DS1307_MTH,8); //?????????? ?????
RTC.set(DS1307_YR,13); //?????????? ???
RTC.start();
*/
}
void(* resetFunc) (void) = 0; //?????????? ?????? ? ?????? ?????, ??? ???? ??????? ?????????? ? ???? ????? ??????????? ?? ?????...
void loop()
{
if (rfid.isCard())
{
if (rfid.readCardSerial()) {
if (rfid.serNum[0] != serNum0
&& rfid.serNum[1] != serNum1
&& rfid.serNum[2] != serNum2
&& rfid.serNum[3] != serNum3
&& rfid.serNum[4] != serNum4
)
{
serNum0 = rfid.serNum[0];
serNum1 = rfid.serNum[1];
serNum2 = rfid.serNum[2];
serNum3 = rfid.serNum[3];
serNum4 = rfid.serNum[4];
lcd.setCursor(0, 0);
lcd.print("CardInfo (DEC):");
lcd.setCursor(0,1);
lcd.print(rfid.serNum[0], DEC);
lcd.print(rfid.serNum[1], DEC);
lcd.print(rfid.serNum[2], DEC);
lcd.print(rfid.serNum[3], DEC);
lcd.print(rfid.serNum[4], DEC);
//??????, ??????????? ???? ????? ???????...
analogWrite(3,20);
delay(500);
analogWrite(3,0);
delay(5000);
lcd.clear();
resetFunc(); //????????? ? ?????? ????...
}
else
{
/* ???????, ??????? ????? ?? ?????????*/
lcd.print("DETECT ERROR");
}
}
}
rfid.halt();
lcd.setCursor(4, 0);
lcd.print(RTC.get(DS1307_HR,true)); //read the hour and also update all the values by pushing in true
lcd.print(":");
lcd.print(RTC.get(DS1307_MIN,false));//read minutes without update (false)
lcd.print(":");
lcd.print(RTC.get(DS1307_SEC,false));//read seconds
lcd.print(" "); // some space for a more happy life
lcd.setCursor(3, 1);
lcd.print(RTC.get(DS1307_DATE,false));//read date
lcd.print("/");
lcd.print(RTC.get(DS1307_MTH,false));//read month
lcd.print("/");
lcd.print(RTC.get(DS1307_YR,false)); //read year
//lcd.print(" D");
//lcd.print(RTC.get(DS1307_DOW,false));
}