22 lines
593 B
Python
22 lines
593 B
Python
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
|
|
from TREx.rfid_driver import RFIDDriver
|
|
|
|
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:
|
|
indication_driver.stop()
|
|
print(id) |