Skip to main content
added 35 characters in body
Source Link
Dave X
  • 2.4k
  • 16
  • 30

You probably need something like:

uint8_t uidTarget[] = { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 };

...
if (success && !strncmp((const char*) uidTarget,(const char*)uidSource,8)) {

Your '=' tries to do an assignment, and an '==' would check if the pointers to the arrays are identical, rather than the contents of the arrays. strncmp() tests equality of strings of characters, and the (const char*) casts the uint8_t values as characters.

Nick Gammon's answer is better.

You probably need something like:

uint8_t uidTarget[] = { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 };

...
if (success && !strncmp((const char*) uidTarget,(const char*)uidSource,8)) {

Your '=' tries to do an assignment, and an '==' would check if the pointers to the arrays are identical, rather than the contents of the arrays. strncmp() tests equality of strings of characters, and the (const char*) casts the uint8_t values as characters.

You probably need something like:

uint8_t uidTarget[] = { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 };

...
if (success && !strncmp((const char*) uidTarget,(const char*)uidSource,8)) {

Your '=' tries to do an assignment, and an '==' would check if the pointers to the arrays are identical, rather than the contents of the arrays. strncmp() tests equality of strings of characters, and the (const char*) casts the uint8_t values as characters.

Nick Gammon's answer is better.

added 300 characters in body
Source Link
Dave X
  • 2.4k
  • 16
  • 30

You probably need something like:

...
ifuint8_t (successuidTarget[] &&= !strncmp(uid,{ 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 };

...
if (success && !strncmp((const char*) uidTarget,(const char*)uidSource,8)) {

Your '=' tries to do an assignment, and an '==' would check if the pointers to the arrays are identical, rather than the contents of the arrays. strncmp() tests equality of strings of characters, and the (const char*) casts the uint8_t values as characters.

You probably need something like:

...
if (success && !strncmp(uid,{ 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 },8)) {

Your '=' tries to do an assignment.

You probably need something like:

uint8_t uidTarget[] = { 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 };

...
if (success && !strncmp((const char*) uidTarget,(const char*)uidSource,8)) {

Your '=' tries to do an assignment, and an '==' would check if the pointers to the arrays are identical, rather than the contents of the arrays. strncmp() tests equality of strings of characters, and the (const char*) casts the uint8_t values as characters.

Source Link
Dave X
  • 2.4k
  • 16
  • 30

You probably need something like:

...
if (success && !strncmp(uid,{ 0x04, 0xEC, 0x89, 0x32, 0x55, 0x42, 0x80 },8)) {

Your '=' tries to do an assignment.