To use the node in your project you should have the cesars/mfrc522 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.
C++ implementation
struct State {
};
{{ GENERATED_CODE }}
void evaluate(Context ctx) {
emitValue<output_DEV>(ctx, getValue<input_522>(ctx));
if (!isInputDirty<input_INIT>(ctx))
return;
auto rfid = getValue<input_522>(ctx);
uint8_t version = 0xFF;
version = rfid->getFirmwareVersion();
if (version == 0xFF) {
Serial.print("Didn't find MFRC522 board.");
while(1); //halt
}
Serial.print("Found chip MFRC522 ");
Serial.print("Firmware ver. 0x");
Serial.print(version, HEX);
Serial.println(".");
emitValue<output_Firmw>(ctx, version);
emitValue<output_DONE>(ctx, 1);
emitValue<output_DEV>(ctx, rfid);
}