Added files via upload
avoid spourious interrupt
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
#include <MFRC522.h>
|
||||
|
||||
#define RST_PIN 9 // Configurable, see typical pin layout above
|
||||
#define SS_PIN 3 // Configurable, see typical pin layout above
|
||||
#define SS_PIN 10 // Configurable, see typical pin layout above
|
||||
#define IRQ_PIN 2
|
||||
|
||||
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance.
|
||||
@@ -71,13 +71,13 @@ void setup() {
|
||||
|
||||
/*Activate the interrupt*/
|
||||
attachInterrupt(digitalPinToInterrupt(IRQ_PIN), readCard, FALLING);
|
||||
|
||||
Serial.println("End setup");
|
||||
|
||||
|
||||
do{ //clear a spourious interrupt at start
|
||||
;
|
||||
}while(!bNewInt);
|
||||
bNewInt = false;
|
||||
|
||||
Serial.println("End setup");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -86,7 +86,6 @@ void setup() {
|
||||
void loop() {
|
||||
|
||||
if(bNewInt){ //new read interrupt
|
||||
bNewInt = false;
|
||||
Serial.print("Interrupt. ");
|
||||
mfrc522.PICC_ReadCardSerial(); //read the tag data
|
||||
// Show some details of the PICC (that is: the tag/card)
|
||||
@@ -95,6 +94,8 @@ void loop() {
|
||||
Serial.println();
|
||||
|
||||
clearInt(mfrc522);
|
||||
mfrc522.PICC_HaltA();
|
||||
bNewInt = false;
|
||||
}
|
||||
|
||||
// The receiving block needs regular retriggering (tell the tag it should transmit??)
|
||||
@@ -135,3 +136,4 @@ void clearInt(MFRC522 mfrc522){
|
||||
mfrc522.PCD_WriteRegister(mfrc522.ComIrqReg,0x7F);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user