omersiar / RFID522-Door-Unlock

Arduino RC522 RFID Access Control
GNU General Public License v2.0
194 stars 87 forks source link

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

Open yasuoiwakura opened 4 years ago

yasuoiwakura commented 4 years ago

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/

omersiar commented 4 years ago

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

DanMan32 commented 3 years ago

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.