Code: Select all
# Create the Phidgets channel object
#print("Creating channel object")
ch = RFID()
# Set the RFID parameters
#print("Setting RFID parameters")
ch.setDeviceSerialNumber(380920)
ch.setIsHubPortDevice(False)
ch.setChannel(0)
# Set device handlers
#print("Setting handlers")
ch.setOnAttachHandler(onAttachHandler)
ch.setOnDetachHandler(onDetachHandler)
ch.setOnErrorHandler(onErrorHandler)
ch.setOnTagHandler(onTagHandler)
ch.setOnTagLostHandler(onTagLostHandler)
#print("Handlers have been set")
try:
ch.open()
except PhidgetException as e:
PrintOpenErrorMessage(e, ch)
raise EndProgramSignal("Program Terminated: Open Failed")
print("Entering while loop")
while((ch.getTagPresent() == False) and (currentRFID != "Empty")):
time.sleep(0.1)
RFIDFile = open('/var/tmp/RFIDOut.txt', 'r')
currentRFID = RFIDFile.readline()
RFIDFile.close()
ch.close()
print("\nExiting...")
sys.stdout.flush()
sys.stdout.close()
sys.stderr.flush()
sys.stderr.close()
return 0
Any help would be greatly appreciated