RFID e arduino MEGA
estou tentando usar um sensor rfid-rc522 com o arduino mega, já peguei vários códigos exemplo e bibliotecas diferentes, mas o sensor não retorna valor, como se não estivesse lendo o cartão, já até mesmo troquei o sensor rfid, mas não deu em nada.
code: [select]
/*
* mfrc522 - library use arduino rfid module kit 13.56 mhz tags spi w , r cooqrobot.
* library file mfrc522.h has wealth of useful info. please read it.
* functions documented in mfrc522.cpp.
*
* based on code dr.leong ( www.b2cqshop.com )
* created miguel balboa (circuitito.com), jan, 2012.
* rewritten søren thing andersen (access.thing.dk), fall of 2013 (translation english, refactored, comments, anti collision, cascade levels.)
* released public domain.
*
* sample program showing how read data picc using mfrc522 reader on arduino spi interface.
*----------------------------------------------------------------------------- empty_skull
* aggiunti pin per arduino mega
* add pin configuration arduino mega
* http://mac86project.altervista.org/
----------------------------------------------------------------------------- nicola coppola
* pin layout should follows:
* signal pin pin pin
* arduino uno arduino mega mfrc522 board
* ------------------------------------------------------------
* reset 9 49 rst
* spi ss 10 53 sda
* spi mosi 11 51 mosi
* spi miso 12 50 miso
* spi sck 13 52 sck
*
* reader can found on ebay around 5 dollars. search "mf-rc522" on ebay.com.
*/
#include <spi.h>
#include <mfrc522.h>
#define ss_pin 53
#define rst_pin 48
mfrc522 mfrc522(ss_pin, rst_pin); // create mfrc522 instance.
void setup() {
serial.begin(9600); // initialize serial communications pc
spi.begin(); // init spi bus
mfrc522.pcd_init(); // init mfrc522 card
serial.println("scan picc see uid , type...");
}
void loop() {
// new cards
if ( ! mfrc522.picc_isnewcardpresent()) {
return;
}
// select 1 of cards
if ( ! mfrc522.picc_readcardserial()) {
return;
}
// dump debug info card. picc_halta() automatically called.
mfrc522.picc_dumptoserial(&(mfrc522.uid));
}
Arduino Forum > International > Portugues > RFID e arduino MEGA
arduino
Comments
Post a Comment