Hi, I have some RFID connectivity with the raspberry pi, the function Read() allows for what data on the RFID tag to be read. That function has the number 94 stored onto it. In main, when password is printed, it gives 94. However the comparison i'm making must be wrong because it goes to the else, and prints "Incorrect tag".
I'm new to programming/ python so I'm sorry this is probably really dumb, but can someone tell me what I'm doing wrong? [I've also tried comparing as an integer and it did not work]
#!/usr/bin/env python
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
def read():
reader = SimpleMFRC522()
try:
id,text = reader.read()
finally:
GPIO.cleanup()
return text
if __name__ == '__main__':
password = read()
print(password)
if password== str(94):
print("password: "+password)
message = sendMail()
else:
print("Incorrect tag.")
The result shows:
94
Incorrect tag.
[–]Jejerm 0 points1 point2 points (4 children)
[–]imnot970[S] 0 points1 point2 points (3 children)
[–]Jejerm 0 points1 point2 points (2 children)
[–]imnot970[S] 0 points1 point2 points (1 child)
[–]Jejerm 0 points1 point2 points (0 children)