Hello everyone!
Through all 3 years of using Arduino, this is the first time i have to ask for help, instead of finding solution by myself (because i've already attempted to find it).
So, idea of my sketch is to read RFID mark and print it to LCD. Sounds easy, but it's not.
For this project i'm using Electrinic brick 125 KHz RFID reader (v0.96) and a 16x2 LCD with Serial driver by SeeedStudio. Both of these are connected to Arduino via Stem Basic Shield (v1.0) also by SeeedStudio.
Here is my code:
#include <SoftwareSerial.h>
#include <SeeedRFIDLib.h>
#include <SerialLCD.h>
#define RFID_RX_PIN 2
#define RFID_TX_PIN 3
#define LCD_RX_PIN 6
#define LCD_TX_PIN 7
#define keys 10
SeeedRFIDLib RFID(RFID_RX_PIN, RFID_TX_PIN);
SerialLCD lcd(LCD_RX_PIN, LCD_TX_PIN);
RFIDTag tag;
long ID;
long RFIDkey[keys];
bool identity = false;
void setup() {
Serial.begin(9600);
Serial.println("Serial Ready");
lcd.begin();
lcd.print("Ready to go!")
RFIDkey[0] = 4905464;
}
void clearLCD() {
lcd.setCursor(0,0);
lcd.print(" ");
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(0,0);
}
void loop() {
if(RFID.isIdAvailable())
{
tag = RFID.readId();
Serial.print("ID: ");
Serial.println(tag.id);
ID = tag.id;
Serial.print("ID (HEX): ");
Serial.println(tag.raw);
Serial.println(ID);
for (int i = 0; i <= keys-1; i++)
{
if (RFIDkey[i] == ID)
{
Serial.println("YES!");
identity = true;
break;
}
}
if (identity){
Serial.print("UR KEY BRO");
clearLCD();
lcd.print("Alright!");
identity = false;
} else {
Serial.println("AWW SO CLOSE");
clearLCD();
lcd.print("Trespasser!");
}
}
}
Here comes the fun part. This code works only with commented "lcd.begin()". Otherwise, all outputs simply don't want to enjoy the magic of friendship (both Serial and LCD output nothing).
Btw, example sketches from both libraries work nice.
I suspected that libraries may have same variables or even functions, but quick analysis showed that everything is O.K..
If you need any additional info, i'll be glad to provide it.
Thanks for reading