structure cleanup and led inclusion in rfid test

This commit is contained in:
paul-loedige 2023-01-17 10:52:43 +00:00
parent 22bb578913
commit 0ce89fab9e
5 changed files with 32 additions and 12 deletions

View File

@ -13,3 +13,12 @@ TRASH_LOCATION = {
"CAN" : 35,
"PAPER" : 45
}
BARCODE_LOOKUP_TABLE = {
'X00UP6UQN' : "PAPER"
}
RFID_LOOKUP_TABLE = {
151652580835 : "INCOMBUSTIBLE",
626325260718 : "CAN"
}

View File

@ -1,12 +0,0 @@
from time import sleep
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
reader = SimpleMFRC522()
while True:
id, text = reader.read()
print(id)
print(text)
sleep(1)
GPIO.cleanup()

23
test_scripts/rfid_test.py Normal file
View File

@ -0,0 +1,23 @@
from time import sleep
import RPi.GPIO as GPIO
from mfrc522 import SimpleMFRC522
import sys
sys.path.append('..')
import TREx.config as config
from TREx.indication_driver import IndicationDriver
reader = SimpleMFRC522()
indication_driver = IndicationDriver()
while True:
id, _ = reader.read()
if id in config.RFID_LOOKUP_TABLE.keys():
trash_category = config.RFID_LOOKUP_TABLE[id]
print(f"{id}: {trash_category}")
indication_driver.indicate(trash_category)
else:
print(id)
sleep(1)
GPIO.cleanup()