and for my entire code, srry didn't fit:
#include <LiquidCrystal.h>
#include <AddicoreRFID.h>
#include <SPI.h>
const int numRows = 2;
const int numCols = 16;
#define uchar unsigned char
#define uint unsigned int
long randNumber117;
long randNumber21;
long randNumber116;
long randNumber68;
int screen = 1000;
uchar fifobytes;
uchar fifoValue;
const int chipSelectPin = 3;
const int NRSTPD = 1;
LiquidCrystal lcd(6, 7, 5, 4, 3, 2);
#define MAX_LEN 16
AddicoreRFID myRFID;
int knop = 8;
int score1 = scorePLR1;
int score2 = scorePLR2;
void setup() {
Serial.begin(9600);
SPI.begin();
lcd.begin(numCols, numRows);
lcd.clear();
pinMode(chipSelectPin,OUTPUT);
digitalWrite(chipSelectPin, LOW);
pinMode(NRSTPD,OUTPUT);
digitalWrite(NRSTPD, HIGH);
myRFID.AddicoreRFID_Init();
pinMode(2, INPUT);
randomSeed(analogRead(0));
}
void loop() {
lcd.setCursor(0,0);
lcd.print(" SCAN PLAYER 1");
lcd.setCursor(0,1);
lcd.print(" Here ");
delay(1000);
uchar i, tmp, checksum1;
uchar status;
uchar str[MAX_LEN];
uchar RC_size;
uchar blockAddr; //Selection operation block address 0 to 63???????
String mynum = "";
str[1] = 0x4400;
//Find tags, return tag type
status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str);
if (status == MI_OK)
{
Serial.println("RFID tag detected");
Serial.print(str[0],BIN);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.println(" ");
}
//Anti-collision, return tag serial number 4 bytes???????
status = myRFID.AddicoreRFID_Anticoll(str);
if (status == MI_OK)
{
checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
Serial.println("The tag's number is : ");
//Serial.print(2);
Serial.print(str[0]);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.print(" , ");
Serial.print(str[2],BIN);
Serial.print(" , ");
Serial.print(str[3],BIN);
Serial.print(" , ");
Serial.print(str[4],BIN);
Serial.print(" , ");
Serial.println(checksum1,BIN);
if(str[0] == 117)
{
lcd.clear();
randNumber117 = random(301);
Serial.print("Hello Sjoerd!\n");
lcd.setCursor(0,0);
lcd.print("SJOERD SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber117);
delay(screen);
int scorePLR1 = randNumber117;
} else if(str[0] == 21) {
lcd.clear();
randNumber21 = random(301);
Serial.print("Hello Mike!\n");
lcd.setCursor(0,0);
lcd.print("MIKE SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber21);
delay(screen);
int scorePLR1 = randNumber21;
}
else if(str[0] == 68) {
lcd.clear();
randNumber68 = random(301);
Serial.print("Hello Noah!\n");
lcd.setCursor(0,0);
lcd.print("NOAH SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber68);
delay(screen);
int scorePLR1 = randNumber68;
}
else if(str[0] == 116) {
lcd.clear();
randNumber116 = random(301);
Serial.print("Hello Jelmar!\n");
lcd.setCursor(0,0);
lcd.print("JELMAR SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber116);
delay(screen);
int scorePLR1 = randNumber116;
}
Serial.println();
}
myRFID.AddicoreRFID_Halt();
delay(1000);
lcd.setCursor(0,0);
lcd.print(" SCAN PLAYER 2");
lcd.setCursor(0,1);
lcd.print(" Here ");
delay(1000);
str[1] = 0x4400;
//Find tags, return tag type
status = myRFID.AddicoreRFID_Request(PICC_REQIDL, str);
if (status == MI_OK)
{
Serial.println("RFID tag detected");
Serial.print(str[0],BIN);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.println(" ");
}
//Anti-collision, return tag serial number 4 bytes???????
status = myRFID.AddicoreRFID_Anticoll(str);
if (status == MI_OK)
{
checksum1 = str[0] ^ str[1] ^ str[2] ^ str[3];
Serial.println("The tag's number is : ");
//Serial.print(2);
Serial.print(str[0]);
Serial.print(" , ");
Serial.print(str[1],BIN);
Serial.print(" , ");
Serial.print(str[2],BIN);
Serial.print(" , ");
Serial.print(str[3],BIN);
Serial.print(" , ");
Serial.print(str[4],BIN);
Serial.print(" , ");
Serial.println(checksum1,BIN);
if(str[0] == 117)
{
lcd.clear();
randNumber117 = random(301);
Serial.print("Hello Sjoerd!\n");
lcd.setCursor(0,0);
lcd.print("SJOERD SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber117);
delay(screen);
int scorePLR2 = randNumber117;
} else if(str[0] == 21) {
lcd.clear();
randNumber21 = random(301);
Serial.print("Hello Mike!\n");
lcd.setCursor(0,0);
lcd.print("MIKE SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber21);
delay(screen);
int scorePLR2 = randNumber21;
}
else if(str[0] == 68) {
lcd.clear();
randNumber68 = random(301);
Serial.print("Hello Noah!\n");
lcd.setCursor(0,0);
lcd.print("NOAH SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber68);
delay(screen);
int scorePLR2 = randNumber68;
}
else if(str[0] == 116) {
lcd.clear();
randNumber116 = random(301);
Serial.print("Hello Jelmar!\n");
lcd.setCursor(0,0);
lcd.print("JELMAR SCORE");
lcd.setCursor(0,1);
lcd.print(randNumber116);
delay(screen);
int scorePLR2 = randNumber116;
}
Serial.println();
}
myRFID.AddicoreRFID_Halt();
delay(1000);
if (score1 > score2) {
lcd.clear();
lcd.setCursor(0,1);
lcd.print("PLR 1 WINS");
}
if (score2 > score1) {
lcd.clear();
lcd.setCursor(0,1);
lcd.print("PLR 2 WINS");
}
if (score2 == score1) {
lcd.clear();
lcd.setCursor(0,1);
lcd.print("IT'S A TIE");
}
delay(10000);
}
}