Main Loop worked great.
RFID read, write and display worked great.
Combined the two, and the RFID is waiting for a TAG to be read ... preventing the Main Loop from running constantly.
How can I have the RFID reader constantly available for new TAGs, yet keep my Main Loop running constantly?
Code below, RFID library that is called is attached:
Mod edit: Added code tags
RFID read, write and display worked great.
Combined the two, and the RFID is waiting for a TAG to be read ... preventing the Main Loop from running constantly.
How can I have the RFID reader constantly available for new TAGs, yet keep my Main Loop running constantly?
Code below, RFID library that is called is attached:
C:
void loop() {
if ( ! mfrc522.PICC_IsNewCardPresent()) { // Look for new RFID cards
return; }
if ( ! mfrc522.PICC_ReadCardSerial()) { // Select one of the RFID cards
return; }
mfrc522.PICC_DumpToSerial(&(mfrc522.uid)); // Dump debug info about the card. PICC_HaltA() is automatically called.
if (mfrc522.uid.uidByte[0] == 0x61) { //
Serial.println(“blue”);
} else {
Serial.println(“card”);
}
Serial.println(); // Go to next line
// read the state of the vibration sensor latch
HITState = digitalRead(HITPin); // vibration sensor latched ON by debounce circuitry?
// if it is, the HITState is HIGH
if (HITState == HIGH) {
digitalWrite(CLEARHITPin, HIGH); // reset debounce circuitry
delay(500); // wait for 1/2 second
digitalWrite(CLEARHITPin, LOW); // complete reset of debounce circuitry
LEDS = LEDS-1; // set LEDS variable for number of LEDs to light
switch (LEDS) {
case 0:
analogWrite(BARGRAPHPin, 00); // 0 LEDs ON
break;
case 1:
analogWrite(BARGRAPHPin, 13); // 1 LED ON
break;
}
} else {
}
delay(50); // wait for 0.05 second
}
Attachments
-
35.3 KB Views: 2
Last edited by a moderator: