I made a new sketch with your code and get a few errors, I'm trying to work them out, if I get em worked out ill post here to.
Code
#include <SPI.h>
#include <MFRC522.h>
#include <SPI.h>
#include <MFRC522.h>
#define koffie 2
#define thee 2
#define RST_PIN 9
#define SS_PIN 10
MFRC522 mfrc522(SS_PIN, RST_PIN);
int koffiePin = 13; //changed to pin 13 for testing (2)
int theePin = 13; //changed to pin 13 for testing (3)
String *koffie_rfid[] = { "46e6868d", "5aadebb" };
String *thee_rfid[] = { "46528b8d", "ea35fbb" };
/**
* Initialize
*/
void setup() {
Serial.begin(9600); //9600 = speed
while (!Serial);
SPI.begin();
mfrc522.PCD_Init();
pinMode(koffiePin, OUTPUT);
pinMode(theePin, OUTPUT);
}
/*
* Helper routine to dump a byte array as hex values to Serial
*/
void dump_byte_array(byte *buffer, byte bufferSize) {
read_rfid="";
for (byte i = 0; i < bufferSize; i++) {
read_rfid=read_rfid + String(buffer[i], HEX);
}
bool card_in_place() {
// Look for new cards
if ( ! mfrc522.PICC_IsNewCardPresent()) {
digitalWrite(koffiePin, LOW);
digitalWrite(theePin, LOW);
return false;
}
// Select one of the cards
if ( ! mfrc522.PICC_ReadCardSerial ()) {
digitalWrite(koffiePin, LOW);
digitalWrite(theePin, LOW);
return false;
}
return true
}
void loop() {
if(!card_in_place)
return;
for(int i = 0; i <= koffies; i++) {
if(koffie_rfid[i] == read_rfid) {
digitalWrite(koffiePin, HIGH);
}
}
for(int i = 0; i <= thees; i++) {
if(thee_rfid[i] == read_rfid) {
digitalWrite(theePin, HIGH);
}
}
}
ERROR:I can't figure out why it keeps making a second library it's starting to bug me.Code
Arduino: 1.6.13 (Windows 10), Board: "Arduino/Genuino Uno"
Test_Code_Single_Scanner_JSP:18: error: cannot convert 'const char*' to 'String*' in initialization
String *koffie_rfid[] = { "46e6868d", "5aadebb" };
^
Test_Code_Single_Scanner_JSP:18: error: cannot convert 'const char*' to 'String*' in initialization
Test_Code_Single_Scanner_JSP:19: error: cannot convert 'const char*' to 'String*' in initialization
String *thee_rfid[] = { "46528b8d", "ea35fbb" };
^
Test_Code_Single_Scanner_JSP:19: error: cannot convert 'const char*' to 'String*' in initialization
C:\Users\harms\OneDrive\Stage Project Arduino\Arduino Stuff\Test_Code_Single_Scanner_JSP\Test_Code_Single_Scanner_JSP.ino: In function 'void dump_byte_array(byte*, byte)':
Test_Code_Single_Scanner_JSP:36: error: 'read_rfid' was not declared in this scope
read_rfid="";
^
Test_Code_Single_Scanner_JSP:41: error: a function-definition is not allowed here before '{' token
bool card_in_place() {
^
Test_Code_Single_Scanner_JSP:75: error: expected '}' at end of input
}
^
Multiple libraries were found for "MFRC522.h"
Used: C:\Users\harms\OneDrive\Arduino Sketchbook\libraries\MFRC522
Not used: C:\Program Files (x86)\Arduino\libraries\rfid
exit status 1
cannot convert 'const char*' to 'String*' in initialization
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.