structure cleanup and led inclusion in rfid test
This commit is contained in:
parent
22bb578913
commit
0ce89fab9e
@ -13,3 +13,12 @@ TRASH_LOCATION = {
|
|||||||
"CAN" : 35,
|
"CAN" : 35,
|
||||||
"PAPER" : 45
|
"PAPER" : 45
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BARCODE_LOOKUP_TABLE = {
|
||||||
|
'X00UP6UQN' : "PAPER"
|
||||||
|
}
|
||||||
|
|
||||||
|
RFID_LOOKUP_TABLE = {
|
||||||
|
151652580835 : "INCOMBUSTIBLE",
|
||||||
|
626325260718 : "CAN"
|
||||||
|
}
|
12
rfid_test.py
12
rfid_test.py
@ -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
23
test_scripts/rfid_test.py
Normal 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()
|
Loading…
x
Reference in New Issue
Block a user