RFID-RC522 with Arduino Pro Micro project. Error on the code?
hi all,
first of newbie...
i trying make below project, keep having type of errors.
let start project page: unlock pc/mac rfid
my hardware:
arduino micro
rfid-rc522
code:
my hardware connections:
https://ibb.co/ngt4or
https://ibb.co/n2qjor
https://ibb.co/nrt2sm
library project installed on arduino ide 1.8.5
library mfrc522
errors when compiling:
can help? getting desperate @ point...
thanks
first of newbie...
i trying make below project, keep having type of errors.
let start project page: unlock pc/mac rfid
my hardware:
arduino micro
rfid-rc522
code:
code: [select]
//get library https://github.com/ljos/mfrc522
//sketch: gudjonholm@gmail.com
/*
pins spi uno mega2560 leonardo
1 (nss) sda (ss) 10 53 10
2 sck 13 52 sck1
3 mosi 11 51 mosi1
4 miso 12 50 miso1
5 irq * * *
6 gnd gnd gnd gnd
7 rst 9 ? reset
8 +3.3v (vcc) 3v3 3v3 3.3v
*/
#include <mfrc522.h>
#include <spi.h>
#include "keyboard.h"
#define sad 10
#define rst 9
#define ledpinopen 4
#define ledpinclosed 3
mfrc522 nfc(sad, rst);
boolean opening = false;
void setup() {
//keyboard.begin();
pinmode(ledpinopen , output);
pinmode(ledpinclosed, output);
spi.begin();
nfc.begin();
byte version = nfc.getfirmwareversion();
}
#define authorized_count 2 /*if want more authorized of cards set count here, , add serials below*/
byte authorized[authorized_count][4] = {
{0x86, 0x7b, 0xd2, 0x48, }
,{0xa5, 0xa0, 0x83, 0x2c, } //example how add more authorized cards
};
boolean issame(byte *key, byte *serial);
boolean isauthorized(byte *serial);
void loop() {
byte status;
byte data[max_len];
byte serial[5];
digitalwrite(ledpinopen, opening);
digitalwrite(ledpinclosed, !opening);
status = nfc.requesttag(mf1_reqidl, data);
if (status == mi_ok) {
status = nfc.anticollision(data);
memcpy(serial, data, 5);
if(isauthorized(serial))
{
opening = !opening; // interruttore on-off
delay(200);
keyboard.print(password here);
delay(500);
keyboard.press(key_return);
delay(200);
keyboard.releaseall();
}
else
{
opening = false;
}
nfc.halttag();
digitalwrite(ledpinopen, opening);
digitalwrite(ledpinclosed, !opening);
delay(2000);
}
delay(500);
}
boolean issame(byte *key, byte *serial)
{
for (int = 0; < 4; i++)
{
if (key[i] != serial[i])
{
return false;
}
}
return true;
}
boolean isauthorized(byte *serial)
{
for(int = 0; < authorized_count; i++)
{
if(issame(serial, authorized[i]))
return true;
}
return false;
}
my hardware connections:
https://ibb.co/ngt4or
https://ibb.co/n2qjor
https://ibb.co/nrt2sm
library project installed on arduino ide 1.8.5
library mfrc522
errors when compiling:
code: [select]
'class mfrc522' has no member named 'begin'
code: [select]
´keyboard`
can help? getting desperate @ point...
thanks
the instructions use leonardo or pro micro, yet using nano. luck!
please show (copy , paste) complete code, using code tags.
please show (copy , paste) complete error messages, using code tags.
to post code and/or error messages:
1) use ctrl-t in arduino ide autoformat complete code.
2) paste complete autoformatted code between code tags (the </> button)
so can see , deal code.
3) paste complete error message between code tags (the </> button)
so can see , deal messages.
4)if posted without code tags, may add code tags by
editing post. not change existing posts in other way.
you may make additional posts needed.
5)please provide links libraries used
(look statements in code #include ). many libraries
are named same have different contents.
before posting again, should read 3 locked topics nick gammon near top of programming questions forum, , links these posts point.
if project involves wiring, please provide schematic and/or wiring diagram and/or clear photograph of wiring.
please show (copy , paste) complete code, using code tags.
please show (copy , paste) complete error messages, using code tags.
to post code and/or error messages:
1) use ctrl-t in arduino ide autoformat complete code.
2) paste complete autoformatted code between code tags (the </> button)
so can see , deal code.
3) paste complete error message between code tags (the </> button)
so can see , deal messages.
4)
you may make additional posts needed.
5)
before posting again, should read 3 locked topics nick gammon near top of programming questions forum, , links these posts point.
Arduino Forum > Using Arduino > Programming Questions > RFID-RC522 with Arduino Pro Micro project. Error on the code?
arduino
Comments
Post a Comment