RFID522-Door-Unlock icon indicating copy to clipboard operation
RFID522-Door-Unlock copied to clipboard

EEPROM\EEPROM.ino:404:16: warning: NULL used in arithmetic [-Wpointer-arith]

Open yasuoiwakura opened this issue 4 years ago • 2 comments

hi there, treid to compile today using the Arduino IDE but gut this error:

\RFID522-Door-Unlock-master\EEPROM\EEPROM.ino: In function 'boolean checkTwo(byte*, byte*)':
\RFID522-Door-Unlock-master\EEPROM\EEPROM.ino:404:16: warning: NULL used in arithmetic [-Wpointer-arith]
   if ( a[0] != NULL )    // Make sure there is something in the array first

Other useds came aross this problem, too so i guess it not necessarily related to my machine? https://www.himix.lt/arduino/arduino-and-rfid-reader-mfrc522-for-door-unlock/

yasuoiwakura avatar Jul 01 '20 13:07 yasuoiwakura

You can safely ignore the warning or even delete the lines 404 and 405.

omersiar avatar Jul 01 '20 13:07 omersiar

I found this problem too, not with compiling in Arduino IDE as that wasn't an issue but also if you register a card UID that leads with a 0, such as 08D6444, then this cards and all cards entered after it are skipped and claim "you shall not pass!"

Code called "servo_motor.ino included as an example in rfid library that came with Elegoo Most Complete Mega Projects.

I changed "if ( a[0] != NULL )" to "if ( a != NULL ) ". Not sure if it is legitimate to compare an entire array to NULL or if the comparison will ever be true (all bytes being 0) but it works.

DanMan32 avatar Apr 08 '21 04:04 DanMan32