Seeed Studio RFID reader

int tag = FindValidTag(code);

This is the call to the function that compares the RFID tag read in to the known values. That function returns 0 if the tag is unknown, or 1 through 5 for each of the known tags.

The return code is stored in tag.

    if(tag > 0 && tag <= ledCnt)
      digitalWrite(LED[tag-1], HIGH);

This code lights up an LED, based on which tag is read. There are 5 LEDs. There is a red one, a blue one, a yellow one, and 2 white ones. I light up an LED that is the same color as the scanned fob or card, since I had LEDs the same color.

This code was just to verify that the RFID was working. The real application for the RFID reader will do more than light LEDs.

Wow you really lost me on that one!

I keep going over your code trying to follow the math and YOU must have a very clear understanding of C. I start off understanding whats going on until after void loop, then it starts getting confusing as h**l. But I'm not giving up yet I'll keep trying for that Ah Ha moment.

Completely lost SubMicro

P.S. what does the * represent?

int FindValidTag(char *code)

The * indicates that the variable that follows is a pointer. There is memory allocated somewhere, with some name associated with it. The code variable is another variable that points to the same memory.

I'm not sure what you are having trouble understanding, or how I can explain it any better.

I've read all the bytes sent by the RFID reader, and stored them in an array.

I pass the location of that array, rather than passing the entire array to FindValidTag. FindValidTag compares the string passed in to each of the known tags. When a match is found, it returns a number.

In loop, that number is used as an index into an array, to get the pin number that an LED is connected to. That pin is set HIGH, turning the LED on.

The reason I’m having trouble is I just started with an Arduino with no previous programming experience. There is a lot of info for the Arduino but it falls short when it comes to the more complicated stuff. Or simply explaining things in better detail, like what the asterisk is.

I just recently found this site from a link here, which is helpfull avr-libc: Related Pages

But still it’s slow going.