Python reading Wiegand dropping Zeros
问题 Here's the code snippet from my RFID wiegand reader on my Raspberry Pi I use already. def main(): set_procname("Wiegand Reader") global bits global timeout GPIO.add_event_detect(D0, GPIO.FALLING, callback=one) GPIO.add_event_detect(D1, GPIO.FALLING, callback=zero) GPIO.add_event_detect(S1, GPIO.FALLING, callback=unlockDoor) while 1: if bits: timeout = timeout -1 time.sleep(0.001) if len(bits) > 1 and timeout == 0: #print "Binary:", int(str(bits),2) c1 = int(str(bits),2) result = ((~c1) >> 1)