Go Down

### Topic: mapping the unique RFID ids of few items with the unique RFID id of a customer (Read 2640 times)previous topic - next topic

#### maitryee

I am making a Smart Cart using RFID. The user will have a RFID card. As soon as he swipes the card on the RFID Reader it will identify the user(by comparing the unique RFID id with an already present id and will create a linked list for that particular user. The linked list will contain the unique Rfid based Ids of the items purchased by the user. In my code the problem is that after the detection of the user it is not creating any linked list for the items/it is not detecting the items bought by the user. Both the user and items are identified by their unique ids (ie RFID tags).It is detecting the user but once the user is being detected it is not mapping the items bought with that user.
Code: [Select]
`int count = 0; // count = 0int i;char input[12];                                         // character array of size 12 boolean flag = 0; // flag =0boolean comparetag(char x[12], char  bb[12]){  boolean ff = false;  int fg = 0;  for (int cc = 0 ; cc < 12 ; cc++)  {    if (x[cc] == bb[cc])    {      fg++;    }  }  if (fg == 12)  {    ff = true;  }  return ff;}   struct Node  {   char x[12];   struct Node *next; }; struct Node* X;struct Node* point;void printList(struct Node *n) {   while (n != NULL)   {     Serial.print( n->x);      n = n->next;   } }struct Node* Shopping( char[]){      Serial.print(input);   // Print RFID tag number       Serial.print("Welcome User");      Serial.println();             Serial.print("Start Shopping ");                struct Node* head = NULL;           head  = (struct Node*)malloc(sizeof(struct Node));             return head;                      }      void setup(){   Serial.begin(9600);  }void loop(){       if(  flag== 0 )      { if (Serial.available())      {      count = 0;      while(Serial.available() && count < 12)          // Read 12 characters and store them in input array      {         input[count] = Serial.read();         count++;         delay(5);      }            if (comparetag(input,"1B006AFA9F14"))      {        flag = 1 ;                            point,X= Shopping(input);      }       else {        Serial.println("not Registered User");}   }}      else{      int c=0;      if (Serial.available())      {        while(Serial.available () && c<12 )          // Read 12 characters and store them in input array      {        Serial.print("Taking Input");         X->x[c] = Serial.read();         c++;         delay(5);      }        struct Node* second = NULL;       second=(struct Node*)malloc(sizeof(struct Node));           second= NULL;               X->next=second;      X =second;            }}      printList(point);      }`

#### AWOL

Code: [Select]
`point,X= Shopping(input);` ?
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

Go Up