Reading Serial String

hey guys, me again

i am trying to read a string from the serial connection, the message is 859B40D5, it is always that long but the data itself changes, can someone tell me how i can read it into a string?

thanks guys

can someone tell me how i can read it into a string?

One character at a time.
As you read in a character, set the next character in the array to '\0'

Is 859B40D5 8 ASCII characters, 4 binary values or what?


Rob

its 8 ASCII characters, and i haven't used an array before so, how do i write them to an array?

I think there's an array example in the IDE

ok, i tried this and it compiles ok but it still doesn't work, can u tell me where i have gone wrong? btw i changed the serial message coming in so it terminates with a ,

while (Serial.available())  {
    char c = Serial.read();
    if (c == ',') {
      stringDone = true;
      if(RFIDString == startGameTag) {
    start1();
  } else {
    if(RFIDString == accessTag1) {
      unlock10;
    }
  }
      RFIDString="";   
     }  
    else {     
      RFIDString += c;
    }
  }

what is

unlock10;


Rob

unlock10(); is a function i wrote which simulates a door unlocking when its called, this project is for a game involving fake door locks, when the key tag is scanned this arduino receives the rfid tag UID via serial, i want it to compare it to known codes and if its ok it "unlocks" the door for 10 seconds then relocks it

soz, forgot to put the () in the code, still no change

ok, i may have been a bit stupid there, it is working now, i made a stupid error in the code :fearful:

thanks for the help guys! :smiley: