arduino and serial.print

hey i have a problem with my code. every time i start the serial monitor and i write this chars 3D00A8BA5E71 , i get instead one time false ... thirteen times false. why? could someone help me?

const char valueTag[13] ="3D00A8BA5E71";

void setup(){ Serial. begin (9600); }

void loop(){ char tag[13];

if(Serial.available()){ while (Serial.available()>0) { char tag = Serial.read(); if (tag == 'valueTag') { Serial.print("true"); } else Serial.print("false"); } Serial.println(); } delay(100); }

char tag = Serial.read();
        if (tag == 'valueTag')

How can a single character ever be the same as a whole multi character constant?

Serial.read() only reads a single byte. It will never be equal to 'valueTag' because valueTag isn't a single character, it's a string. Neither will it be equal to "3D00A8BA5E71", because a single character can't equal an entire string.

You're making the assumption that Serial.read() pulls in the entire string that is put into the serial monitor. It doesn't, it reads the next character in the buffer. So the first time, it will return '3', then 'D', then '0', etc.

valueTag isn't a single character, it's a string.

Sadly it isn't If it were, then the problem would be easier.

AWOL:

valueTag isn't a single character, it's a string.

Sadly it isn't If it were, then the problem would be easier.

valueTag is a string.

'valueTag' is a character.

'valueTag' is a character

No, it's a multicharacter constant.

AWOL:

'valueTag' is a character

No, it's a multicharacter constant.

No, it's a character that the is processed from a multicharacter constant.