int main() // Main function { rfid = rfid_open(rfidSout, rfidEn); // Open reader, start reading while(1) // Main loop { char *str = rfid_get(rfid, 1000); // Wait up to 1 s for card if(!strcmp(str, "timed out")) { // Timed out? print("No ID scanned.\n"); // display "No ID..." drive_speed(0,0); } else if(!strcmp(str, "1E009BC215")) { // Tag A ID match? print("Tag A detected.\n"); // display "Tag A..." drive_speed(64,64); } else if(!strcmp(str, "1E009D9881")){ // Tag B ID match? print("Tag B detected.\n"); // display "Tag B..." drive_speed(-64,-64); } else if(!strcmp(str, "16001A00DC")) { print("Tag C detected.\n"); drive_speed(-32,32); } else if(!strcmp(str, "010DBEA632")){ print("Tag D detected.\n"); drive_speed(32,-32); } else // No matches? print("Unknown ID = %s.\n", str); // print ID. } }
int main() // Main function { rfid = rfid_open(rfidSout, rfidEn); // Open reader, start reading while(1) // Main loop { char *str = rfid_get(rfid, 1000); // Wait up to 1 s for card print("id = %s.\n", str); // Print ID. } }